使用 Blogger 获取 Disqus 评论 API

Getting Disqus comments With Blogger API

我目前正在使用 Blogger API 检索博客 post 并将它们显示在我的应用程序上。我可以将以下代码添加到我的站点应用程序中以添加 Disqus 评论和它的 posting 模块,但是我如何获得 PAGE_IDENTIFIERPAGE_URL 以便来自 Blogger 站点的评论镜像到我的网站应用程序?

使用 Blogger API,我可以检索每个博客 post 的唯一 IDURL.

<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>

我发现 Disqus 将使用博客的 post URL 仅用于跟踪评论线程,因此使用 Blogger API,您可以获得 post 的 URL 并在通用 Disqus 脚本中设置 this.page.url,它将显示来自特定博客 post 的相同评论。