How to optimise page titles in phpBB

by Martin Reed on 1 April 2007 in Snippets

As you may be aware, the standard title structure in phpBB forums is as follows:

Site Name :: View topic – Topic Title

So for example:

Just Chat :: View topic – Borat movie review

This isn’t particularly good for search engine rankings – they place considerable importance on the titles of your pages. Having your site name as the first part of your title means the actual title of the topic drops in importance. The additional inclusion of the phrase ‘View topic’ on each page further dilutes the quality of your titles.

A far better way of having your titles appear (using the example I gave above), would be:

Borat movie review : Just Chat

This places the actual topic being discussed right at the front of the page’s title and as a result, the search engines will rank that phrase more highly compared to if it was tagged on at the end.

It is pretty easy to make this change in phpBB, and I will show you the steps to take below.

Before editing any of your files, ensure you make backup copies in case anything goes wrong – I will not be held responsible for any loss of files or data.

**

1) Open the file ‘templates/subSilver/overall_header.tpl’

At around line 8, you will see the following line:

<title>{SITENAME} :: {PAGE_TITLE}</title>

Replace this with the following line:

<title>{PAGE_TITLE} : {SITENAME}</title>

(This makes the name of the thread / category appear before your site name in the page title)

2) Open the file ‘viewforum.php’ in the root of your forum

At around line 390, you will see the following line:

$page_title = $lang['View_forum'] . ‘ – ‘ . $forum_row['forum_name'];

Replace this with the following line:

$page_title = $forum_row['forum_name'];

(This removes the irrelevant phrase ‘View topic’ in the page title shown when a user views a specific forum / category)

3) Open the file ‘viewtopic.php’ in the root of your forum

At around line 577, you will see the following line:

$page_title = $lang['View_topic'] .’ – ‘ . $topic_title;

Replace this with the following line:

$page_title = $topic_title;

(This removes the irrelevant phrase ‘View topic’ in the page title shown when a user views a specific thread)

You can now decide whether to go a step further and optimise the title shown on the index page of your forum:

4) Open the file language’/lang_english/lang_main.php’

At around line 206, you will see the following line:

$lang['Index'] = ‘Index’;

This is what makes the word ‘Index’ appear on the front page of your forum. You can change this to something more relevant to your site – perhaps add a couple of keywords, so it reads as (using earlier examples):

$lang['Index'] = ‘Chat at Just Chat’;

If you are wondering how to change the name of your forum, that can be done by logging into your admin panel.

That’s it! Let me know how you get on.

Share this community building advice

50 comments

Similar Posts

Previous post:

Next post:

{ 49 comments }

Aron May 4, 2007 at 6:00 am

Hi Martin,
May I know how to display the topic of latest thread on index page. It only display the info of latest user who post thread at the Last Post section. Is it possible to display the topic of latest thread with user’s info? It seems a lot of forums can do it.

Martin Reed May 4, 2007 at 11:31 am

Hi Aron – welcome to the blog, and thank you for your comment.

If you do a search on Google or phpBBhacks you should be able to find something that does this.

I done a little search for you, is this what you are looking for?

http://www.phpbbhacks.com/download/566

stewyoume May 8, 2007 at 10:39 pm

Hi there,

I’m stew new to surfing and the net.

Martin Reed May 8, 2007 at 10:53 pm

Hey stew – Are you planning on setting up your own website? I hope this blog is useful for you.

Yogesh May 11, 2007 at 1:40 am

Good that you put this up, had gotten the same info on DP regarding how to do this. I guess that person might have read about it from here.

Martin Reed May 11, 2007 at 12:15 pm

Grrr those darn plagiarists, eh?!? I hope this article was still useful for you though.

DanaRVT May 17, 2007 at 12:08 pm

Thank you so much for this tip! I have been looking for something like this for awhile now and this was the perfect solution!

Martin Reed May 17, 2007 at 12:14 pm

Thanks for visiting the blog! I am glad the article was useful to you, and hope you become a regular reader :)

Del May 25, 2007 at 8:57 pm

Thank you.

This was just what i was looking for.

I am also looking for the htaccess rules for rewriting the URLs to make them a little more benefitial to the search engines, can you help with this?

Thanks again.

Martin Reed May 25, 2007 at 9:40 pm

Hi Del. I am glad this article was helpful for you.

I am not a coding expert, so would not like to recommend specific actions on how to rewrite URLs with .htaccess.

I would recommend you do some searches over at phpbb.com and on Google as I have seen many hacks and tips in the past that may be what you are looking for.

Naeem July 22, 2007 at 9:14 pm

this article is good . I’ve tried it on my website forum. it’s really work. thanks.

Martin Reed - Blog Author July 22, 2007 at 9:27 pm

Nareem – I am glad you enjoyed the article and that you have successfully implemented these changes on your forum. Good luck with the continued development of your community.

Sperge August 5, 2007 at 2:36 am

Martin, I used your techniques on the phpbb2 version of my board and it worked beautifully – belated thanks.

I have recently upgraded to phpbb3 and have already done some page title optimisation but I haven’t yet been able to optimise the index page title.

On the old board, this was controlled by the variable $lang[’Index’] in lang_main.php

Any idea where to find the equivalent in phpbb3? Thanks.

Smiley August 5, 2007 at 5:06 am

I still can’t bloody delete the view topic thing. Everytime I delete the said code, the page title also disappears with it lol, still playing around with it though!

Martin Reed - Blog Author August 8, 2007 at 1:27 pm

Sperge – I haven’t a clue when it comes to phpbb3 – I believe it is still only a release candidate; therefore it is not recommended to have it installed in a live environment.

Smiley – I have no clue why you are having such difficulties. Only delete/edit the portions I mention – not entire lines!

Leandar August 16, 2007 at 8:09 pm

Hi, Martin

i am using phpbb3 , i hope you will update this helpful information.

Thanks

Martin Reed - Blog Author August 16, 2007 at 10:41 pm

Leandar – As I mentioned to Sperge, phpBB3 is not currently a stable release, therefore I don’t want to publish any hacks. Besides, I am unfamiliar with its code anyway!

Sperge August 21, 2007 at 9:11 pm

Martin, for your info, phpBB3 is currently at Release Candidate 4 and the Gold release is expected any day now. Strictly speaking, a Release Candidate is still not a stable release, as you say, but it’s now very, very close to it.

Martin Reed - Blog Author August 22, 2007 at 12:15 pm

Sperge – A release candidate is not considered a stable release; that’s why I don’t have it installed, and why I don’t want to offer advice on any hacks for that version.

Even when the stable release is launched, I will hold off from upgrading until the majority of the inevitable bugs are fixed.

Flybeers August 24, 2007 at 10:58 pm

Hi there,
finally a breath of fresh air here. I was hoping someone here can point me in the right direction of some kind of good quality live development, motivational seminar? The ones I have seen are just way to expensive, so maybe you have some alternative suggestions. Thanks
Flybeers

Martin Reed - Blog Author August 25, 2007 at 12:47 pm

Flybeers – Thanks for your kind comment. Can you be a bit more specific about what you are looking for? Are you after a live event seminar or an online Webinar? What subject are you looking for? Are you looking for something purely motivational?

abbigliamento October 1, 2007 at 11:45 pm

It’s very helpfull article article in term of seo optimization, good work Martin.

Martin Reed - Blog Author October 3, 2007 at 8:22 pm

abbigliamento – Thanks, I am glad you found the article helpful. Are you running phpBB on any of your websites?

jonathon January 16, 2008 at 12:25 am

thank you, very useful information, i was just searching google looking for just this, but does anyone know how to keep the forum name not ~ ********** ****** all the other pages work apart from each forum index, thanks.

Martin Reed - Blog Author January 18, 2008 at 5:32 pm

jonathon – I’m sorry, I don’t understand your question. Do you want the title to simply show your site name on every page as opposed to the topic/category name?

Eric Martindale February 12, 2008 at 3:43 pm

We’re using a phpBB SEO package, which works very well for us.

Martin Reed - Blog Author February 15, 2008 at 3:29 pm

Eric – Thanks for the heads-up; I’ll be sure to take a look when I start the process of investigating phpBB3.

Loui February 21, 2008 at 12:35 am

Hi Martin

Have made changes to session ID’s but will also use the code you have provided, thank you very much for providing it and all the other informative information presented – an excellent site.

Loui February 21, 2008 at 4:41 am

Hi again

Ive made all the changes to the files, have checked changes a number of times for correctness and can find no fault, could you please have a look at my site Martin and see if any changes have taken place ? (I cannot see any) Got me miffed ?

Martin Reed - Blog Author February 22, 2008 at 7:20 pm

Loui – If you follow the directions, the page titles should be optimised. This only works with phpBB2.x, not the latest phpBB3. Perhaps you missed a line of code or didn’t save a file after editing?

Loui February 22, 2008 at 9:37 pm

Okie dokie Martin, I’ll re-check again :) Cheers for the reply.

Guillermo March 16, 2008 at 11:06 am

Great article, helped me to take away those unnecesary words in the pages titles!

Martin Reed - Blog Author March 17, 2008 at 7:25 pm

Guillermo – Happy to help :)

Chic Desire March 18, 2008 at 2:14 am

Thankyou! This is exactly what I was looking for and helps my site so much better now.

Martin Reed - Blog Author March 19, 2008 at 7:33 pm

Chic – I am glad to have helped.

zorocke March 30, 2008 at 10:50 pm

Thank you for this. I am going to implement this as soon as possible. Ha, I and i want to say that i really love your blog. It has been a great help to me.

Martin Reed - Blog Author April 2, 2008 at 12:51 pm

Zorocke – Thanks for your comment; welcome to Community Spark!

Jamie July 21, 2008 at 6:01 pm

Great tip for optimising. It is always better to have key words and titles come up first. I am glad you found a way to get rid of “view topic.” That should help a lot in search engines recognizing and bringing up more relevant sites.

Martin Reed - Blog Author July 23, 2008 at 3:58 pm

Jamie – Thanks for your comment; I hope to upgrade to phpBB3 soon and will post a new article for that version.

Weasel September 10, 2008 at 12:28 am

If anybody still cares about how to modify page titles in phpBB3 — there is a function called page_header() which sets the PAGE_TITLE. The solution is in the files mentioned in the article above, but in page_header() calls.
Regards.

Martin Reed - Blog Author October 6, 2008 at 8:42 pm

Weasel – Thanks for the advice; I still haven’t moved over to phpBB 3 so I am sure that will help some readers.

Jeremy November 13, 2008 at 5:51 pm

Outstanding Article! I’d always hated the page titles, but I’d never looked into a mod to change them. If only I’d known it was this easy… I just did this mod for phpBB3, so I’ll give a few pointers that would have sped things up for me.

You still change the viewtopic.php and viewforum.php files, as mentioned above, but you have to change the page_header() calls instead, as Weasel mentioned ( THANKS Weasel! ).
Before: page_header($user->lang['VIEW_FORUM'] . ‘ – ‘ . $forum_data['forum_name']);
After: page_header($forum_data['forum_name']);
&
Before: page_header($user->lang['VIEW_TOPIC'] .’ – ‘ . $topic_data['topic_title']);
After: page_header($topic_data['topic_title']);

The language file to edit is totally different in phpBB3. You need to go to forum/language/en/common.php
Before: ‘INDEX’ => ‘Index page’,
After: ‘INDEX’ => ‘New Title’,

Hope it’s okay that I posted this here. This really helped me out, so I wanted to share with others, too. Please let me know if I’ve made any mistakes. This seems to be working fine for me, though.

Martin Reed - Blog Author November 17, 2008 at 8:20 pm

Jeremy – Thanks for the update; that certainly helps bring this article back up to date :)

Mark February 24, 2009 at 10:11 am

I have tried the phpBB3 mods by Jeremy and they work perfectly! Thanks for the valuable info. I suppose I now need to make a new XML sitemap and resubmit it to Google and see what they make of the changes.

Edward February 24, 2009 at 11:04 am

Is the number of words in the title an issue? For example, should you take out things like “View topic”?

Fred March 27, 2009 at 4:09 am

Have you tried this: “phpBB3 SEO Advanced mod Rewrite” from phpbb3-seo website? It looks like doing the job,no?

Martin Reed - Blog Author March 27, 2009 at 3:53 pm

Fred – Sounds like it could well do. Please bear in mind, this is an old article and refers to version 2.x of phpBB.

Rob Cubbon June 10, 2009 at 8:30 am

Thanks a lot. I did 3 of the 4 recommendations. Could not find language’/lang_english/lang_main.php in my phpBB3 files. Just like with blogs it’s good to put blog post titles before site titles I’m sure it’s good to put topic and forum titles before board titles. Thanks!

Mathew Davies August 4, 2009 at 11:25 am

This makes sense on so many levels, I don’t understand why it’s the other way round by default. A website I visit has a long name so if you had 2 + tabs open you couldn’t tell which tab linked to which page, Annoying.

I’ve done the same for Vanilla so if anyone wants to do the same, here’s what you need to change :

1 : Open /themes/head.php

2 : Reverse the order of variables in the title element.

You should end up with something similar to what I have below.

‘.$this->Context->PageTitle.’ – ‘.$this->Context->Configuration['APPLICATION_TITLE'].’

{ 1 trackback }