Skip to content

Instantly share code, notes, and snippets.

@koolamusic
Forked from Soreine/disqus.html
Created January 25, 2019 09:51
Show Gist options
  • Save koolamusic/24b2280440b71a397ffb77a41bf3f577 to your computer and use it in GitHub Desktop.
Save koolamusic/24b2280440b71a397ffb77a41bf3f577 to your computer and use it in GitHub Desktop.
Jekyll include file to integrate disqus comments.
{% if site.disqus_short_name and page.comments != false %}
<div id="disqus_thread"></div>
<script>
var disqus_shortname = '{{ site.disqus_short_name }}';
var disqus_config = function () {
// _config.yml should define the site's URL
this.page.url = '{{ site.url }}{{ page.url }}';
// Using an optional disqus_identifier variable, or the site.url + page.id combination
this.page.identifier = '{% if page.disqus_identifier %}{{ page.disqus_identifier}}{% else %}{{ site.url }}{{ page.id }}{% endif %}';
};
(function() {
var d = document, s = d.createElement('script');
s.src = '//' + disqus_shortname + '.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 %}
@koolamusic
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment