2017-10-09 68 views
0

我最近更新我的版本從0.11.111.12.0鬼1.0 Disqus評論的數量而不是反映了帖子評論

我還添加了PAGE_IDENTIFIER爲每Disqus - JavaScript configuration variables

索引頁面上的評論數量並未反映帖子評論。

每個帖子這link顯示主頁評論數,特別是職位Firefox是0條評論

這火狐後與4

的的Disqus評論數link顯示器以下是我的意見

<script type="text/javascript"> 
    /* * * DON'T EDIT BELOW THIS LINE * * */ 
    (function() { 
    var s = document.createElement('script'); 
    s.async = true; 
    s.type = 'text/javascript'; 
    s.src = '//' + disqus.shortname + '.disqus.com/count.js'; 
    (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); 
    }()); 
</script> 

我是我們當前的腳本荷蘭國際集團下面創建評論數鏈接

<i class="fa fa-comment-o"></i> <a href="{{url absolute="true"}}#disqus_thread" data-disqus-identifier="{{comment_id}}">Comments</a> 

該文的評論腳本如下

<script type="text/javascript"> 

    var disqus_config = function() { 
    this.page.url = '{{url absolute="true"}}'; 
    this.page.identifier = '{{comment_id}}'; 
    this.page.title = '{{title}}'; 
    }; 

    /* * * DON'T EDIT BELOW THIS LINE * * */ 
    (function() { 
    var dsq = document.createElement('script'); 
    dsq.type = 'text/javascript'; 
    dsq.async = true; 
    dsq.src = '//' + disqus.shortname + '.disqus.com/embed.js'; 
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); 
    })(); 
</script> 

問題

我最近更新使用映射器的URL鏈接但這會取代新的page.identifier

如果不是,我可以採取哪些措施來解決評論計數?

調查

count.js文件確實被加載鏈接文本被加載後更換。

2.我發現一個對象是在Disqus計數腳本加載時創建的,稱爲DISQUSWIDGETS。 DISQUSWIDGETS.forum字段未定義。在GitHub上吉斯特

jnowland已經解構了count.js文件,它似乎DISQUSWIDGETS.forum是爲了設置正確的信息檢索數來定義。

回答

0

根據GitHub Gist上的jnowland的count.js文件,disqus_shortname必須在執行Disqus評論計數腳本之前進行聲明和定義。

這將正確設置DISQUSWIDGETS.forum字段。

<script type="text/javascript"> 
    var disqus_shortname = "MY_SHORTNAME"; // Replace MY_SHORTNAME with your DISQUS shortname. 

    /* * * DON'T EDIT BELOW THIS LINE * * */ 
    (function() { 
    var s = document.createElement('script'); 
    s.async = true; 
    s.type = 'text/javascript'; 
    s.src = '//' + disqus_shortname + '.disqus.com/count.js'; 
    (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); 
    }()); 
</script>