Skip to content

Instantly share code, notes, and snippets.

@Nosfheratu
Created September 4, 2013 09:36
Show Gist options
  • Save Nosfheratu/6434822 to your computer and use it in GitHub Desktop.
Save Nosfheratu/6434822 to your computer and use it in GitHub Desktop.
Disqus up and running on Rails
#disqus_thread
:javascript
// put the short name you signed up with here
var disqus_shortname = 'example';
var disqus_developer = #{ Rails.env == "production" ? '0' : '1' };
var disqus_title = "#{ title }";
var disqus_url = "#{ request.url }";
var disqus_identifier = "#{ request.fullpath }";
(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);
})();
<%= render partial: 'shared/disqus', locals: { title: @post.title } %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment