,

How to Set Disqus Configuration Variables.

Disqus is a great discussion add-on available for multi platforms. The installation process is very simple for known CMS and platforms. But my requirement was to add Disqus on a single page app. To get it installed, I landed on this page. Disqus Universal Code looks something like this: <div id="disqus_thread"></div> <script> /** * RECOMMENDED…

By.

•

min read

Disqus is a great discussion add-on available for multi platforms. The installation process is very simple for known CMS and platforms. But my requirement was to add Disqus on a single page app. To get it installed, I landed on this page.

Disqus Universal Code looks something like this:

<div id="disqus_thread"></div>
<script>

/**
*  RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
*  LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables*/
/*
var disqus_config = function () {
this.page.url = PAGE_URL;  // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
};
*/
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = 'https://coinspy.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">comments powered by Disqus.</a></noscript>
They strongly recommend adding Page URL and Page Identifier as to prevent duplicity and easy identification by Disqus for the page where we are using it.
I was facing difficulty in setting those configuration variables, as they are continually giving me the message “We were unable to load Disqus.” and showing this URL.
After spending much time I got it fixed.
For example, your page looks like
then you Disqus conf will be like
var disqus_config = function () {
this.page.url = 'http://example.com/2017/08/02/postid=998';  // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = '/2017/08/02/postid=998'; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
};

This fixed my problem of comments fluctuations also.

4 responses to “How to Set Disqus Configuration Variables.”

  1. Pankaj Vig Avatar
    Pankaj Vig

    •

    Is there a way, this can be automated? Will I need to add this manually everytime?

  2. Ross Lukeman Avatar

    Thank you so much! I just tweaked my Disqus code per your instructions and all comments populated. I too was trying to add it using universal code on a single page, for me within the Kajabi platform. Thank you!

  3. Ifunanyachukwu Nwaokolobia Avatar
    Ifunanyachukwu Nwaokolobia

    •

    Seems clear enough to me. Thanks!

    Please explain this:”Append #disqus_thread to the href attribute in your links. ”

    You’ll find it on the page for installing disqus.
    https://disqus.com/admin/install/platforms/universalcode/

    Thanks.

  4. Chris SNUGGS Avatar
    Chris SNUGGS

    •

    Sorry, it is totally unclear.

    WHAT IS THE “canonical URL”?

    WHAT IS the “PAGE-IDENTIFIER”?

    NOBODY actually explains this, least of all DISQUS.

Leave a Reply

Your email address will not be published. Required fields are marked *