Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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>
  • Loading branch information...
commit f3c68bb73f4763c52dbdfc9d958707e3816d0475 1 parent e53b26a
@omasanori omasanori authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  .themes/classic/source/_includes/head.html
View
2  .themes/classic/source/_includes/head.html
@@ -16,7 +16,7 @@
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1">
- {% capture canonical %}{{ site.url }}{% if site.permalink contains '.html' %}{{ page.url }}{% else %}{{ page.url | remove:'index.html' | strip_slash }}{% endif %}{% endcapture %}
+ {% capture canonical %}{{ site.url }}{% if site.permalink contains '.html' %}{{ page.url }}{% else %}{{ page.url | remove:'index.html' }}{% endif %}{% endcapture %}
<link rel="canonical" href="{{ canonical }}">
<link href="{{ root_url }}/favicon.png" rel="icon">
<link href="{{ root_url }}/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
Please sign in to comment.
Something went wrong with that request. Please try again.