Last active
January 25, 2019 09:51
-
-
Save Soreine/7f717124ffb3cc4e0703 to your computer and use it in GitHub Desktop.
Jekyll include file to integrate disqus comments.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% 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 %} |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just place this file in the
_includefolder and use{% include disqus.html %}anywhere on a page or template. Your_config.ymlshould set the variablesite.disqus_short_nameto your site's Disqus shortname andsite.urlto your site's url. Pages including comments must setpage.commentsto true.