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.
View attachment 66
Log in to the administrator area, head to templates > page container.
In the DOM head section, paste the following:
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:
The next step is to override the open graph sharing URL. Remove the existing open graph URL and replace with:
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:
Comment below if you need any help implementing an international SEO strategy for Xenforo 2 forums.
View attachment 66
Log in to the administrator area, head to templates > page container.
In the DOM head section, paste the following:
Code:
<!-- hreflang tags -->
<link rel="alternate" hreflang="x-default" href="https://sitebee.net{$xf.uri}"/>
<link rel="alternate" hreflang="en-us" href="https://sitebee.us{$xf.uri}"/>
<link rel="alternate" hreflang="en-gb" href="https://sitebee.co.uk{$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:
Code:
<!-- 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:
Code:
<!-- 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:
Code:
{{ base_url('/uri-goes-here/') }}
Comment below if you need any help implementing an international SEO strategy for Xenforo 2 forums.