SEO for PHPBB3 – Site Title, Meta Keywords and Meta Descriptions

Posted in SEO , Web Development on 13 November 2009 20 comments

No offence, but the fact is phpBB has a lot of weaknesses, not seo-friendly being one of them. However, with some simple steps you can improve the SEO of your phpBB. Here in this guide, we will add some basic SEO features to your phpBB by using a better Site Title, adding Meta Keywords and Meta Descriptions. I am using phpBB 3.0.5 for this guide.

A Better Site Title

This is the default site title for phpBB subSilver2 theme.

<title>{SITENAME} &bull; <!-- IF S_IN_MCP -->{L_MCP} &bull; <!-- ELSEIF S_IN_UCP -->{L_UCP} &bull; <!-- ENDIF -->{PAGE_TITLE}</title>

According to the codes above, no matter where you are, your site name would be shown first. This is recommended for your main forum index, but not for viewforum and viewtopic. For better SEO, your forum title or topic title should appear first. That can be achieved by the following codes.

Open your template’s overall_header.php, look for <title></title> tags (like above) and replace it with the following :

<title><!-- IF S_IN_MCP -->{L_MCP} &bull; <!-- ELSEIF S_IN_UCP -->{L_UCP} &bull; <!-- ENDIF -->
   <!-- IF SCRIPT_NAME == "index" -->{SITENAME} - {SITE_DESCRIPTION}
   <!-- ELSEIF SCRIPT_NAME == "viewforum" -->{FORUM_NAME} | {SITENAME}
   <!-- ELSEIF SCRIPT_NAME == "viewtopic" -->{TOPIC_TITLE} | {SITENAME}
   <!-- ELSEIF SCRIPT_NAME == "posting" --><!-- IF S_USER_LOGGED_IN --><!-- IF TOPIC_TITLE -->{L_TOPIC} - {TOPIC_TITLE}<!-- ELSE -->{L_FORUM}<!-- IF FORUM_NAME --> - {FORUM_NAME}<!-- ENDIF --><!-- ENDIF --><!-- ELSE -->{SITENAME}<!-- ENDIF -->
   <!-- ELSEIF SCRIPT_NAME == "ucp" -->{L_VIEWING_UCP} - {PAGE_TITLE}<!-- IF CUR_FOLDER_NAME -->{CUR_FOLDER_NAME}<!-- ENDIF -->
   <!-- ELSEIF SCRIPT_NAME == "mcp" -->{L_VIEWING_MCP}<!-- IF PAGE_TITLE --> - {PAGE_TITLE}<!-- ENDIF --><!-- IF L_TITLE --> - {L_TITLE}<!-- ENDIF -->
   <!-- ELSEIF SCRIPT_NAME == "faq" -->{L_VIEWING_FAQ} - {L_FAQ_TITLE}
    <!-- ELSEIF SCRIPT_NAME == "search" -->{L_SEARCH} <!-- IF SEARCH_TITLE --> - {SEARCH_TITLE}<!-- ENDIF --><!-- IF SEARCH_MATCHES --> - {SEARCH_MATCHES}<!-- ENDIF --> | {SITENAME}
   <!-- ELSEIF SCRIPT_NAME == "memberlist" --><!-- IF S_USER_LOGGED_IN -->{PAGE_TITLE}
    <!-- IF S_SHOW_GROUP --> - {GROUP_NAME}<!-- ENDIF --> | {SITENAME}<!-- ELSE -->{SITENAME}<!-- ENDIF -->
   <!-- ELSEIF SCRIPT_NAME == "chat" -->{L_VIEWING_CHAT}
   <!-- ELSE -->Viewing Undefined page<!-- ENDIF --></title>

This is an edited version of codes taken from another website (I forgot). I found this site title suits me well. Change things around to suit your need.

Now here’s how your site title looks like:

Forum index : Site Name – Forum Description
View Forum : Forum Title | Site Name
View Topic : Topic Title | Site Name

Adding Meta Descriptions

Also in overall_header.php, add this at anywhere in the <head> tag.

<meta name="description" content="<!-- IF SCRIPT_NAME == "viewforum" -->{FORUM_DESC}
<!-- ELSEIF SCRIPT_NAME == "viewtopic" -->{MESSAGE_TRIMMED}<!-- ELSE -->YOUR DEFAULT META CONTENT<!-- ENDIF -->" />

Replace the “YOUR DEFAULT META CONTENT” with the meta description of your site. It will be used on pages when its not viewforum or viewtopic.

MESSAGE_TRIMMED is undefined, yet.

As you can see the template tag {MESSAGE_TRIMMED} is undefined. {MESSAGE_TRIMMED} is a new template tag that should carry not more than 150 characters of the content of first post because most search engines use a maximum of 160 characters for the description.

Open your_phpbb_root/viewtopic.php, look for:

define('IN_PHPBB', true);

Replace with:

$zvloop = 0;
define('IN_PHPBB', true);

Next, look for:

if (isset($cp_row['row']) && sizeof($cp_row['row']))

If you can’t find the line, stop finding and paste the codes below after the big $postrow array. if you found it, paste this codes below before the line:

  if ($zvloop == 0) {
    $zv_topic_trimmed = substr(strip_tags($postrow['MESSAGE']),0,150);
  $zvloop++;
  }

Lastly, look for:

// Output the page
page_header($user->lang['VIEW_TOPIC'] . ' - ' . $topic_data['topic_title']);

Replace it with:

$template->assign_vars(array(
	'MESSAGE_TRIMMED' => $zv_topic_trimmed
));
 
// Output the page
page_header($user->lang['VIEW_TOPIC'] . ' - ' . $topic_data['topic_title']);

That’s it for meta description.

Adding Meta Keywords

Although meta keywords is not important anymore, there’s no harm adding it.

Paste this after your meta description and change the keywords. It wll be used throughout your forum so use suitable keywords.

<meta name="keywords" content="seperate,your,keywords,using,comma,without,any,blank,space" />

Any comments or corrections are welcomed.

 

Posted by Zen on 13 November 2009 • 110,499 visits 20 comments
Tags :


or Subscribe to specific category only :




  - 20 Comments


Kevin says:

Thanks, I was actually looking for something like this…and I found it!

Mark says:

Thank you for the great article! Following these simple steps was about 20x easier than a) trying to find a MOD compatible with my bb b) trying to install that mod and c) trying to configure that mod.

Thanks!!

US says:

I’is good thank you

webforums says:

Very useful and effective guide. Exactly the one I was looking for.
Thank You

Ashutosh says:

Excellent Post Man……Thank You Very Much….Good To see that there are so much people who don’t hesitate to share the knowledge.

FurnessPoker says:

I have just implemented this on my forum, I have always had an issue with duplicated metatags having put a static meta description and keyword into the overall header. So all I can say is a HUGE Thankyou for such a useful article. I am quite a beginner at phpBB3 but found your guide simple to use and was all done in less than 10 minutes

Tobias Fox says:

Good for me, that your post is very well ranked in google for my search term “how to change meta title in phpbb” ;)

You saved me lots of time.

Best,
Tobias

fabio says:

nice tutorial, I found it very usefull! thanks

farneville says:

very nice guide man. Just want to know though. How will the description and keywords work? Are they random or we have to manually put them? How?

Anna says:

Thanks! this seo works fine on my phpbb3

luis3141 says:

Thanks a lot for the article! Its very well explained and my phpbb3 looks much better now :)
I will take a look at the SEO section, i am sure i will find more good tips.

totHoWafferia says:

Tutti possono essere

Kris says:

Hi, i would like to ask you a question…

At title… For example:

Do i have to write the name of the site instead of (SITENAME)?

Peter R says:

I had done changes according to your guidelines but no changes i found in my forum.
After did this changes it showing me error when i refresh the template.
What i do now?
Check my forum – http://forums.linkhunger.com/

Peter R says:

Your Technique is not working :(

nb-ofs says:

does this work on phpbb 3.0.10?
and where does this bit go? as i am slightly unclear

if ($zvloop == 0) {
$zv_topic_trimmed = substr(strip_tags($postrow['MESSAGE']),0,150);
$zvloop++;
}

thanks in advance

Herbisto says:

Going to try and integrate this now. Some really good ideas. If script doesn’t work, you’ve put me on the right track.

Bytza says:

Thankyou very mutch for this tutorial

dav says:

Thanks! I really appreciate the code. I was trying to figure out how to make the title more SEO friendly, i.e., priority words first etc.

Trackbacks

  1. http zenverse net seo for phpbb3 site title… « My Code Snippets

Leave a Reply

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.

Previous Post
«
Next Post
»