Many Disqus Modules On A Single Page

Posted by Weston Ganger on September 05, 2015

For many SPA’s or AJAX sites loading multiple disqus modules per page can be a pain.

You can only show one disqus module at a time. So you must use a button or something that shows and hides on click.

var disqus_shortname = 'disqusShortname';
var disqus_identifier = 'disqusIdentifier';
var disqus_title = 'postTitle';
var disqus_url = 'http://mysite.com/my_url';

if(typeof(DISQUS) === 'undefined'){
  (function() {
    var dsq = document.createElement('script');
    dsq.type = 'text/javascript';
    dsq.async = true;
    dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
} else {
    reload: true,
    config: function() {
      this.page.identifier = disqus_url;
      this.page.url = disqus_url;
      this.page.title = disqus_title;

Related External Links:

Posted in Javascript and Tagged with disqus comments 

Need help on your next project or application?

I specialize in Ruby-on-Rails, AngularJS, Javascript, Bootstrap, and Hybrid Mobile Apps with Cordova & Ionic.

Contact Me

Recommended Posts