Skip to content

Instantly share code, notes, and snippets.

@jschpp
Created February 29, 2016 16:28
Show Gist options
  • Save jschpp/0b268cab449bab19dd26 to your computer and use it in GitHub Desktop.
Save jschpp/0b268cab449bab19dd26 to your computer and use it in GitHub Desktop.
adding disqus
diff --git a/_layouts/post.html b/_layouts/post.html
index e75c724..9f70c29 100644
--- a/_layouts/post.html
+++ b/_layouts/post.html
@@ -23,5 +23,22 @@ layout: default
<div class="post-content" itemprop="articleBody">
{{ content }}
</div>
+{% if page.comments %}
+ <div id="disqus_thread"></div>
+ <script>
+ var disqus_config = function () {
+ this.page.url = "{{ page.url | prepend: site.baseurl | prepend: site.url }}";
+ this.page.identifier = "{{page.url}}";
+ };
+ (function() { // DON'T EDIT BELOW THIS LINE
+ var d = document, s = d.createElement('script');
+ s.src = '//>>DISQUSSHORTNAME<<.disqus.com/embed.js';
+
+ s.setAttribute('data-timestamp', +new Date());
+ (d.head || d.body).appendChild(s);
+ })();
+ </script>
+ <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
+{% endif %}
</article>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment