Skip to main content
All CollectionsTroubleshooting
Why are the wrong URLs detected for my discussions?
Why are the wrong URLs detected for my discussions?
Disqus avatar
Written by Disqus
Updated over 2 years ago

The first time Disqus is loaded on a page, our system creates a new discussion thread and associates that discussion with the URL of the page used during that first load.

In more advanced implementations this may not be desirable; we've provided below a few example situations and solutions.

Situations known to cause the wrong URL to be detected

Previewing pages before publishing

In this scenario, Disqus will associate that preview URL with the discussion thread. For example, say a publishing environment uses www.samplesite.com for its public-facing site and preview.samplesite.com for previewing pages before publishing. If Disqus is loaded in the preview environment, discussion threads will be associated with the preview.samplesite.com domain.

To fix already-affected discussions, see How can I update discussion URLs?

To prevent this from happening further, either:

  1. Prevent Disqus from loading in the preview environment; or,

  2. Set the disqus_url variable upon thread creation.

If your CMS is Hubspot, use the following HubL to prevent Disqus from loading on preview pages.

{% unless request.path_and_query is string_containing "?hs_preview=" %}

{% unless request.full_url is string_containing "preview.hs-sites.com" %}
   
    <div id="disqus_thread"></div>
   
    {% endunless %}

{% endunless %}

Setting the wrong disqus_url variable

To fix already-affected discussions, see How can I update discussion URLs?

Thread URLs cannot be updated by passing `disqus_url` after a thread has been created. `disqus_url` can only be set once, upon thread creation.

Did this answer your question?