Homepage doesn't have canonical URL


(Michael - DiscourseHosting.com) #1

Long story short: it seems like the homepage doesn’t have a canonical URL tag… ?

That’s relevant when you change the hostname of the site and don’t want to redirect everything yet,

and in order to avoid search index entries like http://forum.domain.com?blahblahblah in case someone links to it that way.


My forum is opened with another link
(Jeff Atwood) #2

I do not see the purpose of this request?


(Mittineague) #3

The only possible reason I can see for this regarding the “home” page is for “link and ranking signals” when

https://support.google.com/webmasters/answer/139066?hl=en

Your server is configured to serve the same content for the www subdomain or the http protocol.

But this can be more easily achieved on an individual basis without touching any Discourse code.

Set your preferred domain
Tell Google which version of your site’s URL you prefer for your domain:


(Michael - DiscourseHosting.com) #4

It’s in my post.

Yes, that’s a solution for Google that can be used in case the software does not use a canonical URL.
But I see this as a last resort and a means to fix up an issue with a site. I would indeed require fixing it on an individual basis and it does not solve the ?blablah issue. And… you do know that Google is not the only search engine, right?


(Mittineague) #5

I see it as the first and only necessary approach and I seriously doubt its necessary at all.

Of course, but also I think being obsessed about micro-managing supposed SEO “tricks” is a major waste of time, energy and effort.


(Michael - DiscourseHosting.com) #6

This is not about SEO tricks or being obsessed.

It’s about people changing their hostname or domain name and after three months they find out that search engines picked up that change perfectly except for their home page, which is now twice in the search engine index.

I’m a bit confused here since the necessity seems very clear to me. I see this topic has even been reclassified as a feature, while I’m convinced that the code path for the home page just forgets to call canonical_url


(Jeff Atwood) #7

This seems like such a bad idea, I’m not sure why anyone would want to encourage it?


(Michael - DiscourseHosting.com) #8

Not encouraging, but supporting it would be desirable.
One specific example where this would be handy is to have a soft launch of a rebranding, where you want to communicate the new URL to search engines before communicating it to the customers.
(Real life example)

Another thing is that a third party can cause a search engine issue by causing duplicate content issues by linking to your home page with arbitrary parameters.


This is caught on every page of a Discourse installation except for the home page - because of the fact that the call to canonical_url is just omitted there. I would make a pull request if I was able to determine the exact code path for the home page…