News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Changing "Index" title

Started by MultiformeIngegno, June 10, 2008, 12:29:20 PM

Previous topic - Next topic

MultiformeIngegno

Hi! ;)
I'd like to change the <title></title> of the home page (that is "Name of the Forum - Index") and have something like "Name of the Forum - Main Page"...

What do I have to edit?
Thanks! :)
RockCiclopedia (wiki - forum), Tutta la storia del rock, scritta da voi ...
Rimanere aggiornati sul mondo della musica grazie al nuovo feed "RockCiclopedia Music News"!

spearfish

Forum --> Themes --> Default --> Languages --> Index.English.php


# Line 48
$txt['forum_index'] = '%1$s - Index';

MultiformeIngegno

OK, and how to change it for topics?
I'd like to have "Topic name - name of the board"
RockCiclopedia (wiki - forum), Tutta la storia del rock, scritta da voi ...
Rimanere aggiornati sul mondo della musica grazie al nuovo feed "RockCiclopedia Music News"!

N3RVE

#3
Please, Include details like Forum Version, etc.

For the Index Page, Try changing the code.

In this file:
./Themes/default/Index.template.php

Find:

<meta name="description" content="', $context['page_title'], '" />

Replace with:

<meta name="description" content="Your Chosen Description" />

Find:

<title>', $context['page_title'], '</title>

Replace with:

<title>', ( $context['user']['is_logged'] ? $context['page_title'] : 'Your Title Here' ) , '</title>


Change to desired text.
Thats the bit that will be shown to guests if they try to view any page.

-[n3rve]
Ralph "[n3rve]" Otowo
Former Marketing Co-ordinator, Simple Machines.
ralph [at] simplemachines [dot] org                       
Quote"Somewhere, something incredible is waiting to be known." - Carl Sagan

MultiformeIngegno

Quote from: [n3rve] on June 10, 2008, 01:48:31 PM
Find:

<title>', $context['page_title'], '</title>

Replace with:

<title>', ( $context['user']['is_logged'] ? $context['page_title'] : 'Your Title Here' ) , '</title>

Mmmh... I didn't understand what this code do...

Anyway my forum version is 2.0 Beta 3
RockCiclopedia (wiki - forum), Tutta la storia del rock, scritta da voi ...
Rimanere aggiornati sul mondo della musica grazie al nuovo feed "RockCiclopedia Music News"!

N3RVE

Quote from: lorenzone92 on June 10, 2008, 02:23:09 PM
Quote from: [n3rve] on June 10, 2008, 01:48:31 PM
Find:

<title>', $context['page_title'], '</title>

Replace with:

<title>', ( $context['user']['is_logged'] ? $context['page_title'] : 'Your Title Here' ) , '</title>

Mmmh... I didn't understand what this code do...

Anyway my forum version is 2.0 Beta 3

Thats the bit that will be shown to guests if they try to view any page.

-[n3rve]
Ralph "[n3rve]" Otowo
Former Marketing Co-ordinator, Simple Machines.
ralph [at] simplemachines [dot] org                       
Quote"Somewhere, something incredible is waiting to be known." - Carl Sagan

chadon

 This title code doesn't work on my 2.0 beta 3 forum and didn't show the topic title to guests.
I used a mod I had on the older version:
<title>', $context['page_title'], ' - Your title here</title>

Rumbaar

In $source/Display.php

find:
$context['page_title'] = $topicinfo['subject'];
Change too:
$context['page_title'] = $topicinfo['subject'] - ' , $board , ';
Though I'm not 1005 sure of the $board will be correctly populated.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

chadon

I tested it but for some reason only the first word of the topic name is showing in the meta title.
Here is what I did to show the topic name and board name:
In index.template.php of my theme:
<title>', $context['page_title'] != "$context[forum_name] - Index" ? "$context[forum_name] - " : '', $context['page_title'], '</title>
The problem is that I can't replace the Index word in the home page. When I replace it in the code above I get the forum name displayed twice. The Index word is not very important but I think SMF would really need to be improved to show the board name in the meta title of each topic and board.
This topic meta is "Changing Index title". Wouldn't it be better if it was "Changing Index title - Simple machine Community forum"? All other forum softwares are showing both.

Quote from: Rumbaar on July 03, 2008, 09:14:28 PM
In $source/Display.php

find:
$context['page_title'] = $topicinfo['subject'];
Change too:
$context['page_title'] = $topicinfo['subject'] - ' , $board , ';
Though I'm not 1005 sure of the $board will be correctly populated.

Rumbaar

Quote from: lorenzone92 on June 10, 2008, 01:43:05 PM
OK, and how to change it for topics?
I'd like to have "Topic name - name of the board"
Well I was trying to answer the original creator of this threads question chadon.  You need to change this in the source files and not in the template files.

I've test it this time and it will add the name of the board to the page title
Find in $source/Display.php
$context['page_title'] = $topicinfo['subject'];

Change too:
$context['page_title'] = $topicinfo['subject'] . ' - ' . $board_info['name'];

Displays as in title and meta data as Topic Title - Board Name
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

MultiformeIngegno

#10
Thanks for the replies! :)
RockCiclopedia (wiki - forum), Tutta la storia del rock, scritta da voi ...
Rimanere aggiornati sul mondo della musica grazie al nuovo feed "RockCiclopedia Music News"!

Rumbaar

If this is solved feel free to mark it as solved otherwise reply with some details of what isn't working.  To mark an issue solved please change the first post message icon to the 'tick' icon  or click the 'Topic Solved' button at the bottom of the thread if available.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

MultiformeIngegno

RockCiclopedia (wiki - forum), Tutta la storia del rock, scritta da voi ...
Rimanere aggiornati sul mondo della musica grazie al nuovo feed "RockCiclopedia Music News"!

MultiformeIngegno

Anoher question...
I'd like to have "Index - Forum name" instead of "Forum Name - Index"...

I've changed in
Forum --> Themes --> Default --> Languages --> Index.English.php

$txt['forum_index'] = '%1$s - Index';

to

$txt['forum_index'] = 'Index - %1$s';

... but it doesn't work.. :(
RockCiclopedia (wiki - forum), Tutta la storia del rock, scritta da voi ...
Rimanere aggiornati sul mondo della musica grazie al nuovo feed "RockCiclopedia Music News"!

Rumbaar

Are you sure you are editing it in the correct language file?  As I just changed it on my SMF 2.x forum and it worked perfectly how you wanted it.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

MultiformeIngegno

OK, it worked, was my cache...
Now there's another problem, I've upgradedd to Beta 4 and I can't find that option anymore... :(
RockCiclopedia (wiki - forum), Tutta la storia del rock, scritta da voi ...
Rimanere aggiornati sul mondo della musica grazie al nuovo feed "RockCiclopedia Music News"!

Rumbaar

You can't find the cache?  I can't say I've used BETA 4 yet, but I don't think the changes were that great that they moved/hide/ or removed that feature.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

MultiformeIngegno

D'oh!
I mean, I can't find anymore in:
Forum --> Themes --> Default --> Languages --> Index.English.php

the line:
$txt['forum_index'] = '%1$s - Index';
RockCiclopedia (wiki - forum), Tutta la storia del rock, scritta da voi ...
Rimanere aggiornati sul mondo della musica grazie al nuovo feed "RockCiclopedia Music News"!

Rumbaar

Can you find $txt['forum_index'] at all?
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

chadon

In the beta 4 the line has been replaced by:
$txt['forum_index'] = '%1$s - Index';

Advertisement: