Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: MultiformeIngegno on June 10, 2008, 12:29:20 PM

Title: Changing "Index" title
Post by: MultiformeIngegno on June 10, 2008, 12:29:20 PM
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! :)
Title: Re: Changing "Index" title
Post by: spearfish on June 10, 2008, 01:22:56 PM
Forum --> Themes --> Default --> Languages --> Index.English.php


# Line 48
$txt['forum_index'] = '%1$s - Index';
Title: Re: Changing "Index" title
Post by: MultiformeIngegno 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"
Title: Re: Changing "Index" title
Post by: N3RVE on June 10, 2008, 01:48:31 PM
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]
Title: Re: Changing "Index" title
Post by: MultiformeIngegno 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
Title: Re: Changing "Index" title
Post by: N3RVE on June 10, 2008, 03:01:37 PM
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]
Title: Re: Changing "Index" title
Post by: chadon on June 19, 2008, 12:02:58 PM
 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>
Title: Re: Changing "Index" title
Post by: 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.
Title: Re: Changing "Index" title
Post by: chadon on July 04, 2008, 10:16:53 AM
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.
Title: Re: Changing "Index" title
Post by: Rumbaar on July 04, 2008, 06:38:13 PM
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
Title: Re: Changing "Index" title
Post by: MultiformeIngegno on September 07, 2008, 01:01:34 PM
Thanks for the replies! :)
Title: Re: Changing "Index" title
Post by: Rumbaar on September 07, 2008, 06:18:13 PM
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.
Title: Re: Changing "Index" title
Post by: MultiformeIngegno on September 07, 2008, 06:30:11 PM
Setted the tick icon! :)
Title: Re: Changing "Index" title
Post by: MultiformeIngegno on September 08, 2008, 04:48:18 AM
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.. :(
Title: Re: Changing "Index" title
Post by: Rumbaar on September 08, 2008, 08:50:49 AM
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.
Title: Re: Changing "Index" title
Post by: MultiformeIngegno on September 08, 2008, 04:33:57 PM
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... :(
Title: Re: Changing "Index" title
Post by: Rumbaar on September 08, 2008, 05:53:41 PM
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.
Title: Re: Changing "Index" title
Post by: MultiformeIngegno on September 08, 2008, 06:07:00 PM
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';
Title: Re: Changing "Index" title
Post by: Rumbaar on September 08, 2008, 06:44:17 PM
Can you find $txt['forum_index'] at all?
Title: Re: Changing "Index" title
Post by: chadon on September 08, 2008, 07:40:28 PM
In the beta 4 the line has been replaced by:
$txt['forum_index'] = '%1$s - Index';
Title: Re: Changing "Index" title
Post by: Rumbaar on September 08, 2008, 08:06:19 PM
Which is the same as in 3.1 :)
Title: Re: Changing "Index" title
Post by: chadon on September 08, 2008, 08:29:52 PM
 :o I must need glasses.
Then there is no changes in the beta 4  :D