I'm currently using the Blogger API
to retrieve blog posts and display them on my app. I can add the following code into my site app to add the Disqus comments and it's posting module, but how would I get the PAGE_IDENTIFIER
and PAGE_URL
so that the comments from the Blogger site mirror onto my site app?
With the Blogger API
, I am able to retrieve each blog post's unique ID
and the URL
.
<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 = '//codingbarrier.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" rel="nofollow">comments powered by Disqus.</a></noscript>
I found out that Disqus
will use the Blog's post URL
only to track the comment thread, so using the Blogger API
, you can get the post's URL
and just set this.page.url
in the generic Disqus script and it'll show the same comments from the specific blog post.