Technical SEO
Staff member
If you are running the Xenforo forum community script and looking to implement hreflang tags, here is the solution. This is based on using separate ccTLD domains.


Log in to the administrator area, head to templates > page container.

In the DOM head section, paste the following:
    <!-- hreflang tags -->
<link rel="alternate" hreflang="x-default" href="{$xf.uri}"/>
<link rel="alternate" hreflang="en-us" href="{$xf.uri}"/>
<link rel="alternate" hreflang="en-gb" href="{$xf.uri}"/>

Remember to update the href to your domains. Additionally, your going to need to override the canonical tag. Remove your existing canonical tag and replace with:
    <!-- canonical tag -->
<link rel="canonical" href="{$xf.fullUri}" />

The next step is to override the open graph sharing URL. Remove the existing open graph URL and replace with:
    <!-- social metas -->
<meta property="og:url" content="{$xf.fullUri}" />

Save the container file, head over to one of your forum post's and view the HTML source. Can you see the hreflang tags?

Tip* if you have any absolute hard-coded URLs in your footer and header navigation. I would recommend switching them to relative URLs. You can do this by adding the following in the URL:
{{ base_url('/uri-goes-here/') }}

Comment below if you need any help implementing an international SEO strategy for Xenforo 2 forums.
Last edited: