Cookie Consent by Free Privacy Policy Generator

SEO for MyBB Forum

Do you use myBB forum script? I have a quick and easy way to improve your forum SEO. Out of the box, myBB is a great way to create and build a community on your website. myBB is a free open source PHP/MySQL forum script.

mybb1.png


I have used myBB on a few websites over the years it’s a great way to build traffic and attract links. As with everything myBB has its pros and cons. The pros are it's free and easy to set up, it's extendable with plugins. The cons being it's not all that great at SEO. That's the reason I’m writing this blog post today, I’m going to demonstrate how you can improve SEO for myBB.


We’ll run through the following:
  • Improve HomePage Metas (title and description)
  • Improved Meta Titles and Meta Description for Threads
  • Canonical URLs for Threads
  • Structured Data (schema – JSON LD) – Threads
  • Open Graph – Threads
  • H1 Tags – Threads
  • Improved Meta Titles for Forums

We’ll be editing the following template files:
  • Index
  • Showthread
  • Forumdisplay

I’ll start with the forum homepage, have you noticed the meta title only shows your forum name? Have you also noticed there’s no meta description? Here’s a solution to improve it.

Login into admin ACP > Themes & Style > Templates

mybb2.png


Homepage Metadata​

You are looking for the template set called Index Page Templates. In this example we will be modifying the default template, if you have a custom theme you can modify that.

Open the filename called Index (within Index Page Template)

Find:
Code:
[php]<title>{$mybb->settings[‘bbname’]}</title>[/php]

Replace with:
Code:
[php]<title>About my Forum – {$mybb->settings[‘bbname’]}</title>
       <meta name="description" content="Write a meaningful description here to describe what your forum community is about and why we should join." />[/php]

We have replaced the boring plain forum bbname title with a more meaningful title. Use keywords relating to your forum contents. Also make sure you write a meta description, no more than 230 characters.

Improved Meta Titles and Meta Description for threads​

Moving on, by default myBB does not have meta descriptions, which personally I find a little odd, but hey-ho I’m sure the developers have their reasons. The meta titles are also a little flaky, certainly room for improvement.

The title for threads is just that, the thread title. What I have done to improve the title is to add the bbname and page ID. That will go a long way to improving your forums SEO, and gone are the duplicate titles for page numbers as I have added the page ID to rectify that. For the meta description, I have used the postpreview tag, it pulls the first sentence from the thread.

Open the filename called showthread (within Show Thread Template)

Find:
Code:
[php]<title>{$thread[‘subject’]}</title>[/php]

Replace with:
Code:
[php]<title>{$thread[‘subject’]} – {$mybb->settings[‘bbname’]} – Page {$page}</title>
<meta name="description" content="{$thread[‘postpreview’]} {$page}" />[/php]

Canonical URLs for Threads​

Add the following snippet just below the newly modified title and description. Be sure to replace mydomain.com with your website’s domain name.

Code:
[php]<link rel="canonical" href="https://www.mydomain.com{$_SERVER[‘REQUEST_URI’]}">[/php]

Structured Data (Article Schema – JSON-LD) – threads​

Moving on, and staying with the showthread file. I will now show you how to add structured data to threads. Add the following snippet of code just below the newly added canonical tag. Be sure to replace the image path with your website logo or whatever image you prefer. Lastly, replace SiteName with your website or community name.

Code:
[php]<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "NewsArticle",
"headline": "{$thread[‘subject’]}",
"datePublished": "<?=my_date($mybb->settings[‘dateformat’], $thread[‘dateline’])?>",
"description": "{$thread[‘postpreview’]}",
"image": {
"@type": "ImageObject",
"height": "",
"width": "",
"url": "add image here"
},
"author": "{$thread[‘username’]}",
"publisher": {
"@type": "Organization",
"logo": {
"@type": "ImageObject",
"url": "add image here"
},
"name": "SiteName"
},
"articleBody": ""
}
</script>[/php]


Open Graph (OG) – threads​

Staying with the showthread file. We’re gonna add basic OpenGraph tags, they are especially useful for generating snippets of information for when somebody shares a forum thread link on social media giants such as Facebook and Twitter. You will need to replace mydomain.com with your domain name. You should also update the image with your website logo. You can also replace SiteName.

Add the following just below the Schema Article markup:
Code:
[php]<meta property="og:type" content="article">
<meta property="og:title" content="{$thread[‘subject’]}">
<meta property="og:url" content="https://www.mydomain.com{$_SERVER[‘REQUEST_URI’]}">
<meta property="og:image" content="https://image.ibb.co/jLc17G/1.png">
<meta property="article:author" content="SiteName"> [/php]

H1 Headings Tag for Threads​

We are done with the head section, now I will show you how to add H1 headings to your thread pages. H1 headings will help to increase the organic search visibility (rankings) of your forum threads and posts. Staying with the showthread file.

Find:
Code:
[php]
<td class="thead">

<div class="float_right">
<span class="smalltext"><strong><a href="javascript:void(0)" id="thread_modes">{$lang->thread_modes}</a>{$threadnoteslink}</strong></span>
</div>

<div>
{$thread[‘threadprefix’]}{$thread[‘subject’]}
</div>

</td>

</tr>

[/php]


Replace with:
Code:
[php]
<td class="thead">

<div class="float_right">
<span class="smalltext"><strong><a href="javascript:void(0)" id="thread_modes">{$lang->thread_modes}</a>{$threadnoteslink}</strong></span>
</div>

<div>

<h1>{$thread[‘threadprefix’]}{$thread[‘subject’]}</h1>

</div>

</td>

</tr>

[/php]

Please note, you may need to style the H1 heading tags to match the overall style and feel of your myBB community forums.


Improved Meta Titles for forums​

Last but certainly not least, I will show you how to improve SEO for the forum pages. Very similar technique as the threads, we’re improving the meta title. This is to help Google and other search engines to better understand the forum pages and their contents. We’re also stopping and duplicate titles.

Open the filename called forumdisplay (within Forum Display Template)

Look for:
Code:
[php]<title>{$mybb->settings[‘bbname’]} – {$foruminfo[‘name’]} </title>[/php]

Replace with:
Code:
[php]<title>{$foruminfo[‘name’]} – {$mybb->settings[‘bbname’]} – Page {$page}</title> [/php]

Final Thoughts​

Firstly let me start with, I would not recommend you implement the above recommendations straight to your live community forums. Test them out on a fresh installation of myBB or on a backup copy of forums. They should all work just fine, but I would rather warn you first. I have done the above tweaks on a fresh installation of myBB and popular forums I run called Gigarocket.

When you do the action the tweaks to your live website, be sure to use the ‘Fetch as Google’ and requesting indexing for all pages in Google Search Console. You should start to see an uplift in traffic after a couple of weeks.

There are other tweaks I could write to improve SEO but in the interest of time. I will save those for another day. Feel free to comment below, I will happily answer any questions. If you found this tutorial please link to it or share it across your favourite social media channels.
 
Back
Top