【问题标题】:Have same Disqus thread on multiple URL's在多个 URL 上具有相同的 Disqus 线程
【发布时间】:2014-06-16 03:29:00
【问题描述】:

我有 3 个 URL 都指向同一个页面,例如:

www.example.com/index.php?q=8236894
www.example2.com/index.php?q=8236894
www.example3.com/index.php?q=8236894

因为查询字符串“q”都是一样的,我希望它们都加载同一个disqus线程。关于如何实现这一点的任何想法?

【问题讨论】:

    标签: javascript disqus


    【解决方案1】:

    旧线程,但我遇到了同样的问题,所以我想我会分享我的解决方案!

    pedrum golriz 提供的链接很有帮助。我们在这里实现了它:www.learnerds.com

    在目标页面上,我们使用了以下代码:

    <script>
    
    var url = window.location.href;   \\ grabs the complete url with the query strings
    var temp = new Array();  \\ creates an array that will store our values
    temp = url.split('?');   \\ this function splits the url into 2 parts 
                             \\ temp[0] (everything before the question mark) & temp[1] (everything after the question mark)
    disqus_url = temp[0];   \\sets the disqus_url to be the same regardless of query strings
    
    </script>
    

    您也可以使用 window.location.href.split('?')[0] 来减少代码行数。

    希望有帮助!

    【讨论】:

      【解决方案2】:

      在这里找到的 disqus 文档http://help.disqus.com/customer/portal/articles/472098-javascript-configuration-variables 应该会有所帮助。

      基本上,确保您将 discus_* 变量设置为相同的值。此外,所有网站都需要添加到您的“受信任域”列表中(或者,列表必须为空)。

      【讨论】:

        猜你喜欢
        • 2017-03-25
        • 1970-01-01
        • 2018-03-10
        • 1970-01-01
        • 2013-07-17
        • 2014-03-21
        • 2017-08-06
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多