Browse code

Do not strip trailing slash of canonical URLs.

Usually, links for posts are generated with a trailing slash, but
canonical URLs aren't. Some services (e.g. http://b.hatena.ne.jp/)
are confused with that behavior.

We can fix it by removing canonical URLs, but then anyone may read
a post with /index.html URL and post the URL to some tool or service.
Therefore rel="canonical" seems useful IMHO.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>

OGINO Masanori authored on 28/05/2012 at 08:21:26
Showing 1 changed files
... ...
@@ -16,7 +16,7 @@
16 16
   <meta name="MobileOptimized" content="320">
17 17
   <meta name="viewport" content="width=device-width, initial-scale=1">
18 18
 
19
-  {% capture canonical %}{{ site.url }}{% if site.permalink contains '.html' %}{{ page.url }}{% else %}{{ page.url | remove:'index.html' | strip_slash }}{% endif %}{% endcapture %}
19
+  {% capture canonical %}{{ site.url }}{% if site.permalink contains '.html' %}{{ page.url }}{% else %}{{ page.url | remove:'index.html' }}{% endif %}{% endcapture %}
20 20
   <link rel="canonical" href="{{ canonical }}">
21 21
   <link href="{{ root_url }}/favicon.png" rel="icon">
22 22
   <link href="{{ root_url }}/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">