Hacking Simple Machines Forum For SEO
By Gerard McGarry on 17th March 2008, filed in Internet Technologies, Search Engine Optimisation. You can leave a response below.
The Simple Machines Forum is a great free php forum system. Unfortunately, out of the box it’s the most poorly search engine optimised piece of rubbish you’re likely to ever experience. But then, most forumware is.
When I installed the Unreality TV Forum, the first thing I did was to make the layout fixed-width for better legibility. The liquid layout of most forum themes results in long lines that are difficult to read without getting cataracts or worse! But that’s a usability thing.
The first thing I’m tackling for SEO reasons is titling. The page title is correct - it follows the format of the topic title. But on-page, the title is repeated loads of times, but not once with any sort of semantic meaning. I’m talking about the H1 tag here.
How do we tell Google what the page is about? Kick it off with a title wrapped in <h1></h1>. The problem with SMF themes is that they’re badly commented and hard to navigate. So here’s how I do it.
Theme Inheritance
There is a default theme included with SMF that all other themes derive from. The template that handles topic display is called display.template.php. If you want to customise this template, never do it to the default version - always copy the file to your custom theme folder.
The way inheritance works is that SMF will look for a customised display template first. If it doesn’t find one, it’ll revert to the default. So, bearing that in mind, let’s begin.
Take a copy of the display.template.php from the default theme folder and copy it into your current theme folder. We’ll edit this file to override the default forum topic display.
Hacking The Topic Display Template
Round about line 208 on the display template, there’s a bit of code that displays the topic title and the number of views that topic has had.
<td valign="middle" width="85%" style="padding-left: 6px;" id="top_subject"> ‘, $txt[118], ‘: ‘, $context['subject'], ‘ (’, $txt[641], ‘ ‘, $context['num_views'], ‘ ‘, $txt[642], ‘)</td>
What I did was to take out the number of views and put that piece of code elsewhere. Once that was done, I wrapped the resulting code in <h1> tags, giving some semantic richness to the topic title.
The modified code (minus the page views) is this:
<td valign="middle" width="85%" style="padding-left: 6px;" id="top_subject"> <h1 class=”topictitle”>’, $context['subject'], ‘</h1></td>
Now, I made this change to our forum less than a week ago. I want to give Google a bit of time to reindex the site and take into account the new page structures. It’ll be interesting to see if this relatively simple change makes a long term difference to ranking on the forum.
Hacking The Forum Users
One of the biggest problems in running a forum is that you give up control over input to your members. And your members are probably not SEO aware.
I had a word with some of our power members and asked them to be more thorough with their titles - including full names and details where possible. I didn’t approach this as an SEO issue - I approached it as a usability issue. Because we republish our latest forum headlines on the Unreality blogs, it was important that those topics made sense to any readers browsing the website.
So, we approached this from a usability point of view, which is correct. But we also hopefully gain SEO benefits.
Other SMF Hacks
There are a couple of other things I’d like to hack in SMF if I could. One is the poor URLs the system generates. The other is a full semantic reworking of the topic display template so that it’s not completely dependent on table-based layouts. If anybody’s done any work on this kind of thing, I’d love to hear it.







