2
votes

On my site the same Disqus thread shows up on all pages.

I have tried:

  var currentPageId = '/testo';

  window.disqus_shortname = 'strengthtracker';
  window.disqus_identifier = currentPageId;
  window.disqus_url = 'http://strengthtracker.apphb.com/' + currentPageId;

and:

  var currentPageId = '/testo';

  var disqus_shortname = 'strengthtracker';
  var disqus_identifier = currentPageId;
  var disqus_url = 'http://strengthtracker.apphb.com/' + currentPageId;

Both yeild the same result, the same thread shows up everywhere even though the currentPageId changes.

What am I doing wrong here?

1

1 Answers

6
votes

Because some of the identifiers were used with the same URL together, they got tied together permanently. The 'disqus_identifier' and 'disqus_url' get set when the thread is first loaded, and ignored later if a thread exists with the same identifier and/or URL.

Take this scenario:

Thread #1 is loaded for the first time with:

disqus_url = "http://example.com"
disqus_identifier = "identifier_1"

Result: New thread created with those variables

Thread #2 is loaded for the first time with:

disqus_url = "http://example.com"
disqus_identifier = "identifier_2"

Result: "identifier_2" is appended to Thread #1. Calling either identifier from now on will grab the same thread regardless of the URL.


This usually happens when an identifier or URL component (such as 'currentPageId') is undefined or is only whitespace, so it's best practice to check for that before loading the Disqus embed.