Canonical URL variable + unique identifier variable

Hello :slight_smile:

I would love to know how to find the following variable for a given Webflow page that would have been created through my Webflow CMS (most likely the CMS page’s template)

  1. Webflow page’s canonical URL variable
  2. Webflow page’s unique identifier variable

I am using the disqus pluggin to allow people to comment ony ma pages.
It seems really promising but need to add those two variables into the embed code as required below:

  /**
    *  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
    };
    */

Any ideas ?
Thank youf very much ! :hugs:
Anthony

2 Likes

Hello,

I am wondering if there was ever an answer to this? I am having the same issue.

I saw on an earlier discussion board that it wasn’t necessary to change any of the Disqus code. However, on the site I’m working on, the Disqus code doesn’t seem to work on the dynamic content page (e.g. blog posts). (It does seem to work on the static pages). I think this may be because I need the same variables mentioned above (unless I am misunderstanding something).

Thanks for you help.
Lakis

1 Like

Hi @Lakis,

I think there is indeed nothing to change really.
At least everything is working fine on the project I’m working on.
I also have dynamic blog post like pages and the discus comments appears to stick to their respective blog post. I think you just need to register an account on discus and insert your site url into the discus custom code.

Mine looks 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 = 'YOU NEED TO PUT YOUR SITE DISCUS ADRESS EMBED HERE/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>
2 Likes

Okay, thanks so much @anthonysalamin. Good to know that it’s working for you – so at least that’s not problem on my site! I’ll keep trying to figure it out.

Lakis

Hello all :wave:

I’m using the disqus plugin too :raised_hands: and I’m also wondering about the variables. In a previous post @Waldo was saying that there’s no need to change the code, but in the Webflow blog the code looks like this:

            var disqus_config = function() {
              this.page.identifier = '/blog/how-to-pick-your-design-career-path-a-guide-to-modern-design-roles'; // 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 = '//webflowblog.disqus.com/embed.js';

              s.setAttribute('data-timestamp', +new Date());
              (d.head || d.body).appendChild(s);
            })();

One line is missing and I think they just don’t need this.page.url = ‘a unique URL for each page where Disqus is present’;

But somehow the this.page.identifier variable is taking the page url.

I’m using disqus for a site with a blog (like many of us) The comments need to be dynamic and what I’ve made is placing the embed code and using the add field option in the embed element

But still the script on the site is not looking like the Webflow script and this makes me think that I’m not doing the right things :smile:

Here’s how it looks on the Webflow Blog:

You can see the url after page.identifier

Here’s how it look on the site I’m working on

After page.identifier is the slug because I’m using dynamic embed, but it’s not the same and I’m wondering what is @webflow doing :slight_smile:

Piter :webflow_heart:

Hello!

Thanks for reaching out to us, and we’ll be with you shortly!

This is a short, automated “got-it” email to let you know we’ll be reviewing your support request soon!

If you need immediate assistance, you’ll find answers to common questions at Webflow University. If you don’t find your answer there, you can always check out the Webflow Community Forum to search for your topic or ask for help!

Our support hours are from 6AM to 6PM Pacific Time, Monday through Friday, and we’re usually able to reply to all support requests within one business day.

Thanks in advance!

The Webflow Customer Success Team

We hope this response was helpful, and we’d really love to hear your feedback! How did we do?

Great Just Okay Not Good

Want the fastest possible response? Include your Webflow account email, site URL, read-only link, and screenshots.