Not a bug Please add missing rel="canonical" meta tags to some pages (login, register, lost-password, help, poll results)


Well-known member
Affected version
This isn't a huge deal but these are the only XenForo pages that a crawler regularly reports as "<link rel=canonical> not found". All other XenForo pages already have a rel="canonical" meta tag out of the box. :)(y)

--- a/src/addons/XF/_data/templates.xml
+++ b/src/addons/XF/_data/templates.xml
@@ -42549,6 +42549,8 @@ {
   <template type="public" title="help_index" version_id="2001070" version_string="2.0.10"><![CDATA[<xf:title>{{ phrase('help') }}</xf:title>
+<xf:macro template="metadata_macros" name="canonical_url" arg-canonicalUrl="{{ link('canonical:help') }}" />
 <xf:wrap template="help_wrapper" />
 <xf:if is="$pages is not empty">
@@ -45586,6 +45588,8 @@ body:not(.lg-from-hash) .lg-outer.lg-start-zoom .lg-item.lg-complete .lg-object
 <xf:title>{{ phrase('log_in') }}</xf:title>
+<xf:macro template="metadata_macros" name="canonical_url" arg-canonicalUrl="{{ link('canonical:login') }}" />
 <xf:if contentcheck="true">
     <div class="blockMessage blockMessage--error blockMessage--iconic">
@@ -45707,6 +45711,8 @@ body:not(.lg-from-hash) .lg-outer.lg-start-zoom .lg-item.lg-complete .lg-object
   <template type="public" title="lost_password" version_id="2000033" version_string="2.0.0 Beta 3"><![CDATA[<xf:title>{{ phrase('lost_password') }}</xf:title>
+<xf:macro template="metadata_macros" name="canonical_url" arg-canonicalUrl="{{ link('canonical:lost-password') }}" />
 <xf:form action="{{ link('lost-password') }}" class="block" ajax="true">
     <div class="block-container">
         <div class="block-body">
@@ -53330,6 +53336,8 @@ button,hr,input{overflow:visible}audio,canvas,progress,video{display:inline-bloc
 <xf:title>{{ phrase('register') }}</xf:title>
+<xf:macro template="metadata_macros" name="canonical_url" arg-canonicalUrl="{{ link('canonical:register') }}" />
 <xf:if is="$providers is not empty">
     <div class="block">
         <div class="block-container">

It would furthermore be awesome if you could add a rel="canonical" meta tag to "poll_results" pages. But this seems to require more than a template change because the following code generates a relative instead of an absolute URL:
<xf:macro template="metadata_macros" name="canonical_url" arg-canonicalUrl="{{ $poll.getLink('results') }}" />


XenForo developer
Staff member
On the whole, I don't think this is a bug and we aren't directly planning on canonicalizing these pages per se, though we may make a per-page judgement call. Note that there are many pages in XF that don't necessarily output a rel=canonical. We mostly focus on doing it for the "main" pages.

In terms of some of the listed pages, they have actually been set (or are now set) to noindex. Given that rel=canonical is mostly for search robots, if they're noindex pages, then setting a canonical value isn't likely to have much value.


Well-known member
Thank you for adding a canonical meta tag to the help pages.

Regarding the login, register and lost-password pages: Why have you set them to "noindex" (not yet in 2.1 RC1 but here on and therefore probably in 2.1 RC2)? I think it should be possible to google those pages.


XenForo developer
Staff member
If it's something you feel strongly about, you can adjust it, but the general wisdom is that these sort of pages don't provide much value to search engines and thus it's better to not index them. (They have effectively no unique content anyway.)


Well-known member
Thank you for the explanation. I'll revert this change in our forum.

(IMHO, excluding those pages from SERPs is "SEO gone too far". Those pages don't have much content, that's correct. But they have a very specific purpose and it should be possible to find them in search engines. Three pages with "thin content" won't make a difference considering that most forums probably have hundreds or thousands of threads with thin content that don't use "noindex".)


Well-known member
We noindex everything except homepage/forum index, forums and threads (and albums, categories, media if XFMG is used), there really is no point in indexing pages that don't contain real content and are basically the same on every XF2 installation anyway.

DragonByte Tech

Well-known member
I think this depends on the search query. If I google for "xenforo lost password" then it'd be great if Google could guide me directly to I agree that queries like "xenforo register" are probably less likely (not sure about "xenforo login").
I'm extremely confused as to why anyone would google how to recover their password. Are you saying that if someone tries to login, sees the "wrong username or password. lost password? click here" page, they will close that tab, open a new tab, go to Google and type "sitename lost password"?

That seems a little far fetched to me, but maybe I don't understand users :D


Active member
I'm extremely confused as to why anyone would google how to recover their password
In a world where people search for the whole URL because the search box on their default web page (i.e. Google) is bigger than the actual address bar, you should not wonder about anything...

Use-case where it might be possible to search for "$serviceName lost password": There is a breach where credentials got leaked. I'm not sure about the password I've set ages ago in a forum. But it might be one of the leaked ones. So I want to change it. Since I'm not sure which password was set, I go straight to the lost password page - because if I don't remember, that's where I have to go eventually anyway.

Just a random thought - no bad feelings either way tho. Just contributing to this idea :)