Streaming live at 10am (PST)

Adding disqus to a blogpost template


#1

Hi guys

You recommend using disqus to add comments so thats what im trying to do, but you must know what to add to the universal code it tells you to use to make this work with webflow

Ive added their code to the bottom of the blog post template - it works fine if i add the url of a specific blog post but of course as its a template I need to make it dynamic
so what do i write to make comments specific to the specific post thats being read?

http://academic-blogsite.webflow.io/posts/ actual blog page
http://academic-blogsite.webflow.io

Shown below is the part of the code snippet where i need to change PAGE_URL and PAGE_IDENTIFIER to make this work. I dont know php but its something to do with this variable? <? php echo $my_identifier; ?>

If you could adjust this code snippet for me, oh boy would i be grateful. I think this would prove very useful for many potential cms/blog webflow users

Regards
Paul Oram

/*
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 = '//academicblogsite.disqus.com/embed.js';
    
    s.setAttribute('data-timestamp', +new Date());
    (d.head || d.body).appendChild(s);
})();

#2

Hello @pauloram :smile:

You actually don't have to change anything about the script which is auto generated by disqus :smile:

Just insert the code generated by disqus into a dynamic page template where you want the disqus to show up.

Then for every dynamic post page (say blog post pages in the blog page template), you'll have a unique discussion to that post :). I've tested it extensively and it works PERFECTLY.

Happy disqus'ing in Webflow :wink:

Waldo


#3

I posted in two of your blog posts. It's working! :smiley:

Great job.


#4

Thanks Waldo

Indeed good to know, you dont need to change anything! The Disqus instructions are therefore quite confusing as the last thing you imagine you need to do is nothing!

I think its worth adding this point to the webflow knowledge page concerning disqus and commenting.

Paul


Disqus doesn't appear on the publish site
#5

Huge thanks for this! Hopefully everyone sees this when making the decision to integrate Disqus into their website - "no changes" are the best changes when it comes to embedding code!


#6

Are there any posts in the forums (I've looked and I didn't see them) on displaying the comment counts on posts?

I'd love to add that feature but I'm not sure how to make it work.


#7

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.