Browse Source

Use canonical URL for Disqus, fixes #236

unreleased_contents
Frederic Hemberger 13 years ago
parent
commit
514e84831c
  1. 5
      .themes/classic/source/_includes/disqus.html
  2. 2
      .themes/classic/source/_includes/head.html

5
.themes/classic/source/_includes/disqus.html

@ -1,13 +1,12 @@
{% comment %} Load script if disquss comments are enabled and `page.comments` is either empty (index) or set to true {% endcomment %} {% comment %} Load script if disquss comments are enabled and `page.comments` is either empty (index) or set to true {% endcomment %}
{% if site.disqus_short_name and page.comments != false %} {% if site.disqus_short_name and page.comments != false %}
<script type="text/javascript"> <script type="text/javascript">
var disqus_shortname = '{{ site.disqus_short_name }}'; var disqus_shortname = '{{ site.disqus_short_name }}';
{% if page.comments == true %} {% if page.comments == true %}
{% comment %} `page.comments` can be only be set to true on pages/posts, so we embed the comments here. {% endcomment %} {% comment %} `page.comments` can be only be set to true on pages/posts, so we embed the comments here. {% endcomment %}
// var disqus_developer = 1; // var disqus_developer = 1;
var disqus_identifier = '{{ site.url }}{{ page.url }}'; var disqus_identifier = '{{ canonical }}';
var disqus_url = '{{ site.url }}{{ page.url }}'; var disqus_url = '{{ canonical }}';
var disqus_script = 'embed.js'; var disqus_script = 'embed.js';
{% else %} {% else %}
{% comment %} As `page.comments` is empty, we must be on the index page. {% endcomment %} {% comment %} As `page.comments` is empty, we must be on the index page. {% endcomment %}

2
.themes/classic/source/_includes/head.html

@ -16,7 +16,7 @@
<meta name="MobileOptimized" content="320"> <meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1"> <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' }}{% endif %}{% endcapture %} {% capture canonical %}{{ site.url }}{% if site.permalink contains '.html' %}{{ page.url }}{% else %}{{ page.url | remove:'index.html' | strip_slash }}{% endif %}{% endcapture %}
<link rel="canonical" href="{{ canonical }}"> <link rel="canonical" href="{{ canonical }}">
<link href="{{ root_url }}/favicon.png" rel="icon"> <link href="{{ root_url }}/favicon.png" rel="icon">
<link href="{{ root_url }}/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css"> <link href="{{ root_url }}/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">

Loading…
Cancel
Save