News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Domain name displayed in the title of all topics

Started by spytrdr, October 08, 2007, 06:15:08 PM

Previous topic - Next topic

spytrdr

A lot has been written about "Search engine friendly urls" and how they don't work as advertised.

What I'd like SMF to do instead is to ALSO and ALWAYS DISPLAY the DOMAIN NAME in the TITLE tag of each topic, and not the topic title ALONE as it is currently. So, if a given topic is entitled "Welcome to SMF" the browser's title bar should be displaying not only that BUT "Simple Machines Community Forum - Welcome to SMF".
In the case of this topic it would be: "Simple Machines Community Forum - Domain name displayed in the title of all topics".
Or SimpleMachines.org, whatever you choose.
Could that be that hard to do? Something as simple as that would help with search engines enormously.



burobu

Yeah, I agree this should be done by default (though it would make more sense id the domain was displayed AFTER the topic name).

You can easily make this happen now though

in index.template.php find
<title>', $context['page_title'], '</title>';

replace with

<title>YOUR FORUM URL OR NAME - ', $context['page_title'], '</title>';

spytrdr

#2
Cool!

And instead of entering it manually, with a variable ($context['forum_name']) it would be even cooler, now that I've checked the guts of index.template.php. But don't know anything about php and don't want to miss any quotes, how would it be, burobu? Is this correct?:

<title>', $context['forum_name'], ' - ', $context['page_title'], '</title>';


spytrdr

Quote from: spytrdr on October 09, 2007, 12:21:03 PM<title>', $context['forum_name'], ' - ', $context['page_title'], '</title>';

Just tried my version and it works fine, but it's not so clean because now in the main index and a couple of other areas (stats, calendar) it displays the domain name twice, but not elsewhere (boards, topics, posts).

karlbenson

Something like the following should work, If the forum name matches the page title, it won't be shown.

<title>', (($context['forum_name'] != $context['page_title']) ? $context['forum_name'],' - ' : '' ), $context['page_title'], '</title>';

Advertisement: