Skip to content

Commit

Permalink
Fixes disqus IDs to be (more) unqiue across a site.
Browse files Browse the repository at this point in the history
Fixes issue #22 by prefixing the article's slug with year and month. This is still not guaranteed to be unique, but anything other than the URL hardly is, and the point of not using the URL is to protect from future changes of the URL (such as from moving to a different URL layout for the site). The date of a post, at least up to year and month, is hopefully highly unlikely to change once comments start accumulating (if it does prior to the first comment, that doesn't matter, really).
  • Loading branch information
hlapp committed Jan 5, 2014
1 parent cba78e5 commit 93ac9d2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion templates/includes/comment_count.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{% if DISQUS_SITENAME %}<p><small>There are <a href="{{ SITEURL }}/{{ article.url }}#disqus_thread" data-disqus-identifier="{{ article.slug }}">comments</a>.</small></p>{% endif %}
{% if DISQUS_SITENAME %}<p><small>There are <a href="{{ SITEURL }}/{{ article.url }}#disqus_thread" data-disqus-identifier="{{ article.date|strftime('%Y-%m-') ~ article.slug }}">comments</a>.</small></p>{% endif %}
2 changes: 1 addition & 1 deletion templates/includes/comments.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ <h2>Comments</h2>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = '{{ DISQUS_SITENAME }}'; // required: replace example with your forum shortname
var disqus_identifier = '{{ article.slug }}';
var disqus_identifier = '{{ article.date|strftime('%Y-%m-') ~ article.slug }}';
var disqus_url = '{{ SITEURL }}/{{ article.url }}';

/* * * DON'T EDIT BELOW THIS LINE * * */
Expand Down

0 comments on commit 93ac9d2

Please sign in to comment.