Skip to content

Instantly share code, notes, and snippets.

@jimmyhillis
Last active December 10, 2015 04:58
Show Gist options
  • Save jimmyhillis/4384337 to your computer and use it in GitHub Desktop.
Save jimmyhillis/4384337 to your computer and use it in GitHub Desktop.
Jade markup for integrating Disqus within a template
#disqus_thread
noscript Please enable JavaScript to view the
a(href='http://disqus.com/?ref_noscript') comments powered by Disqus
a(href="http://disqus.com", class="dsq-brlink") comments powered by
span(class="logo-disqus") Disqus
script
var disqus_shortname = 'shortname_here';
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
@jimmyhillis
Copy link
Author

I generally prefer to have the JavaScript outside of the markup (e.g. not inline) but this way makes it easier to add extra disqus_ settings be set through your view variables, if you need that.

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