• Welcome to Simple Machines Community Forum. Please login or sign up.

Always having your board name in the title of your forum

Started by Burpee, April 25, 2005, 12:57:46 PM

Previous topic - Next topic

jepot5

Quote from: modtang on September 04, 2005, 08:23:09 PM
Quote from: Burpee on April 25, 2005, 12:57:46 PM
The problem now is that the index of your forum is going to have something like "My community - My community - Index" as a title. This is easily fixed through the language files.
Anyone else using SimplePortal? I'm getting MY COMMUNITY - MY COMMUNITY and I can't seem to fix it. Any suggestions?

Other than that this works great. Thanks a bunch. :)

in Sources/TPortal.php, find:
$context['page_title'] =

remove
$context['forum_name']

replace with your own

jepot5

Quote from: ccbtimewiz on August 20, 2008, 10:21:13 AM
Quote from: jepot5 on August 20, 2008, 04:05:59 AM
Hi
how do I fix this so whenever i go to someone's profile, I will see this

{Custom text I inputed} - Viewing Profile: {Display name}

Open profile.php

Find:
// Set the page title if it's not already set...
if (!isset($context['page_title']))
$context['page_title'] = $txt['profile'] . ' - ' . $txt[$_REQUEST['sa']];


Replace with:
// Set the page title if it's not already set...
if (!isset($context['page_title']))
$context['page_title'] = 'Text you want to show '.$txt['profile'] . ' - ' . $txt[$_REQUEST['sa']];


thanks for the help, but not working,

i think the profile pages integrate with tinyportal as when i did the editing for tinyportal (see above post) it also shows the same title when viewing profiles only

and also help me fix
My Community - My Community: Calendar (The first phrase is what I entered and I want to remove "My Community:")

serge06

Any way to have the title show:
Board Name - Forum Category - Post Title

for even better SEO
Thanks

krick

I'm using this...


$context['page_title'] = $context['linktree'][0]['name']. ' - ' .
                                      $context['linktree'][1]['name']. ' - ' .
                                      $context['linktree'][2]['name']. ' - ' .
                                      $context['linktree'][3]['name'];


To get...

forum title - category - board name - topic

...as my page title.

The only problem is that when I'm at higher levels of the hierarchy, I get extra dashes.  I need to add code to omit the empty elements.

Paracelsus

Since I didn't like to put "Home" or "Index" in the first page, my solution was:

In index.template.php put a "short version" of the board name + page title:
<title>F&oacute;rum SCP - ', $context['page_title'], '</title>';

In index."language".php put the trimmed part to have the "long version" of the board name, since this is shown just in Home or Index page:
$txt[18] = 'A Comunidade do Sporting Clube de Portugal';

So in sum, except for Index page where we have the full forum title, every other page show "Fórum SCP - Page Title".

Sabby72

Could Someone please tell me if I did something wrong. I don't think I did, but the title now shows up as - - Index, whereas it used to show up as - Index. I obviously missed something, as it didn't change to show the forum name.

Here's what I replaced:
Index.template.php on line 79:
<title>', $context['forum_name'], ' - ', $context['page_title'], '</title>';

index.english.php on line 36:
$txt[18] = 'Index';

Thanks. As you can see, I'm somewhat new to php.


sabby

I give up. I've tried this at least a dozen times now and it never works.

Paracelsus

Quote from: Sabby72 on August 30, 2008, 04:37:08 PM
Could Someone please tell me if I did something wrong. I don't think I did, but the title now shows up as - - Index, whereas it used to show up as - Index. I obviously missed something, as it didn't change to show the forum name.

Here's what I replaced:
Index.template.php on line 79:
<title>', $context['forum_name'], ' - ', $context['page_title'], '</title>';

index.english.php on line 36:
$txt[18] = 'Index';

Thanks. As you can see, I'm somewhat new to php.



It probably means that in Boardindex.php in Sources - I think it's this file that uses $txt[18], you have most likely something weird before $txt[18] that gives - - before the Index word the whole time.

krick

Sabby, undo your other changes, and then add this to index.template.php ....
(just the new code part between the begin/end comments)



function template_main_above()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;

// -- begin build better page title --
$tboard = $context['linktree'][2]['name'];
$tboard = empty($tboard)?'':' - '.$tboard;
$ttopic = $context['linktree'][3]['name'];
$ttopic = empty($ttopic)?'':' - '.$ttopic;
if (! ereg($context['forum_name'], $context['page_title']))
$context['page_title'] = $context['linktree'][0]['name'].$tboard.$ttopic;
// -- end build better page title --

krick

For some reason, the code in my last post generates errors in the log.

This version of the code doesn't.  Am I missing something subtle about the PHP syntax?


$tboard = empty($context['linktree'][2]['name'])?'':' - '.$context['linktree'][2]['name'];
$ttopic = empty($context['linktree'][3]['name'])?'':' - '.$context['linktree'][3]['name'];
if (! ereg($context['forum_name'], $context['page_title']))
  $context['page_title'] = $context['linktree'][0]['name'].$tboard.$ttopic;

SleePy

Jeremy D — Site Team / SMF Developer
Support the SMF Support team!
Profiles:GitHub
Join us on IRC Libera.chat/#smf

minos

hi .. i delete  $txt[18] = $context['forum_name'] . ' - &Iacute;ndice';

from my index english and spanish  index but does not work

studentforums

I want the page number of the topic to display in the title. I understand I have to modify Sources/Display.php among others.

These two lines from Display.php are where I think the problems are

   censorText($topicinfo['subject']);
   $context['page_title'] = $topicinfo['subject'] . " - " . $txt['page'] . $context['page_info']['current_page'];

There is another piece of code in Sources/Messageindex.php which does the smes thing for the boards.

     // 'Print' the header and board info.   
     $context['page_title'] = strip_tags($board_info['name'] . " - " . $txt['page'] . $context['page_info']['current_page']);

Why does the second piece of code display the page number but not the first?
I only help those that help themselves. I suppose I am a bit like GOD that way.
If you realise anything useful, say something useful and help someone else.

Student forum for GCSE, IGCSE, IB, O & A Level and University Students

Arantor

Likely you'll see an error in the error log for an undefined index for $context['page_info']['current_page'] in the first case; it's built differently from what I remember of it.
No good deed goes unpunished
All helpful urges should be circumvented

thischarmingmanc

The whole concept is  very bad for SEO the SMF guys knew what they were doing.

to add the same word for verey page on your site, dilutes your unique content, thus making every page on your site less search engine friendly. 

Quote from: Aileen on November 26, 2007, 05:54:56 AM
I tried using a keyword. This one is good for SEO

Arantor

Quote from: thischarmingmanc on August 17, 2009, 11:38:50 AM
The whole concept is  very bad for SEO the SMF guys knew what they were doing.

to add the same word for verey page on your site, dilutes your unique content, thus making every page on your site less search engine friendly.

Not if it's the site name or contains a unique keyword that is relevant to the site.
No good deed goes unpunished
All helpful urges should be circumvented

Shark-Time



Providing Cheapest Offshore Hosting as low as 5$/year.
MoneyBookers | AlertPay
Pm Me

studentforums

Ok I think the title is to my satisfaction apart from my quibbles in my last post.
I only help those that help themselves. I suppose I am a bit like GOD that way.
If you realise anything useful, say something useful and help someone else.

Student forum for GCSE, IGCSE, IB, O & A Level and University Students

heavyccasey


Shark-Time



Providing Cheapest Offshore Hosting as low as 5$/year.
MoneyBookers | AlertPay
Pm Me

Advertisement: