Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disqus comments fails to load on localhost?

I would like to use the universal code and have ran into difficulties getting the most basic functionality done.

I would like to create a shortname for test and one for my deployment, which I did from the Disqus admin panel.

Here is the disqus code in my show action:

# inside show.html.erb <%= render raw 'comments' %>  # partial "comments"    <div id="disqus_thread"></div>     <script type="text/javascript">       var disqus_shortname = '<%= Post::DISQUS_SHORTNAME %>';       var disqus_identifier = '<%= @post.id %>';       var disqus_url = '<%= url_for([:blog, @topic, @post])%>';         (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);         })();     </script>     <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>     <a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a> 

In my model I define Post, I define my short name like so:

  DISQUS_SHORTNAME = if Rails.env.development?                          "dev-shortname".freeze                      else                         "shortname".freeze                      end 

I can confirm the loading spinner is functioning but that is it. Am I missing something obvious? When I try to include only_path: false as a second option in my url_for call, I get an exception stating I have supplied to many arguments to the method. Otherwise my disqus just hangs.

like image 488
rhodee Avatar asked Feb 28 '12 03:02

rhodee


People also ask

Why are Disqus comments not loading?

Disqus comments not loading. If a website owner has tweaked some settings related to some cache plugin this can happen. In this case, the only option you have is to bring the issue to the notice of the site owner. If after an update there a core file that has changed or if there is a conflict, Disqus will fail to load.

How do I embed Disqus in HTML?

Here's how it works: Grab the direct link to the comment. Visit https://embed.disqus.com/ and enter the link into the box. Copy the embed code into a blog post or website and publish.


2 Answers

you should set this to make it work:

var disqus_developer = 1; // this would set it to developer mode 

Reference: http://ray247.wordpress.com/2009/09/02/how-to-develop-with-disqus-on-localhost/

like image 58
You knows who Avatar answered Sep 18 '22 09:09

You knows who


None of the solutions above worked for me as of September 2013.

To get it to work I had to add localhost to the "Trusted Domains" list on this page:

http://[disqus_shortname].disqus.com/admin/settings/advanced/

and also use the "Universal Code" found below to embed it into my blog posts:

http://[disqus_shortname].disqus.com/admin/settings/universalcode/

And it works! :)

like image 22
rlueder Avatar answered Sep 21 '22 09:09

rlueder