0

Dear Stack Overflow community,

I'm hosting a blog on Github Pages which is running on Jekyll. Canonicalization works fine on the index page (usabilityreport.de -> www.usabilityreport.de) whereas it doesn't on subpages. usabilityreport.de/user-experience should lead to this page but instead it results in a generic 404 page.

GitHub does not allow .htaccess files so I can't use RewriteEngine On. My research has only lead me to a canonicalization tag in the which has no effect.

  <link rel="canonical" href="{{ site.url }}{{ page.url | replace:'index.html',''}}">

The complete code is available on GitHub.

RBT
  • 24,161
  • 21
  • 159
  • 240

1 Answers1

0

rel=canonical link element indicates the preferred URL to search engines, it won't have any effect redirecting webpages.

As you are building your links with {{ site.url }} prefix, then make sure site.url contains your preferred website version, i.e., includes www. prefix.

In _config.yml:

   url: www.usabilityreport.de/
marcanuy
  • 23,118
  • 9
  • 64
  • 113
  • Thanks for the quick answer! I added the desired url to my _config.yml but it still wont redirect. – Johannes Borchard May 08 '17 at 13:12
  • @JohannesBorchard the problem is not redirecting, but generating the link with the proper prefix – marcanuy May 08 '17 at 13:16
  • Just checked your page, it is working online: http://www.usabilityreport.de/user-experience. Locally it won't change anything because it is working with `localhost`. – marcanuy May 08 '17 at 13:21
  • I pushed it to GitHub right away and never tested it locally. For me it's still not working under http://usabilityreport.de/user-experience – Johannes Borchard May 08 '17 at 13:42
  • You might be visiting a cached version, test again in a while and it should work. – marcanuy May 08 '17 at 14:13
  • I just contacted my domain service. There has been a problem with the name server entries. Thank you anyway for the help! – Johannes Borchard May 08 '17 at 17:32
  • Could you please elaborate? You must share the correct answer if you're using this forum, please don't be mean :) – sudoCoder May 17 '20 at 14:25