摘要: 我正在設置disqus以在我們的MVC .net網站的頁面上顯示評論計數。我之前在Tumblr頁面上「修復」了這個功能,所以我認爲我有必要的技能在這個網站上很容易地做到這一點,但是沒有成功。我也回顧了Ryan的所有(https://stackoverflow.com/users/1370956/ryan-v)適用答案,但還沒有找到解決方案。Disqus無法顯示評論數
我下面從disqus.com方向本:
https://help.disqus.com/customer/portal/articles/565624
但我有沒有成功。我的理解是,我需要做的是:
- 添加腳本與它
- 插入內disqus_shortname替換附加到文章的網址的結尾「#disqus_thread」一href標記
一旦完成,我認爲腳本應該插入評論計數編號並將其顯示在頁面上 - 但這不適用於我。
在tumblr你應該插入一個meta標籤
<meta name='text:Disqus Shortname' content='' />
,但我並不認爲適用於我的設置(雖然這並沒有給它一個嘗試阻止我)。
我只能假設我錯過了一些明顯的東西。我想知道是否localhost環境正在中斷我的測試,因爲我正在使用顯示disqus註釋的本地主機頁面的鏈接。我也使用一個live disqus評論頁面進行了測試,但結果相同。
詳情: 目前我已經測試了一些錯事,但我相信,以下是最不出錯:
腳本:
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'My-Shortname'; // required: replace example with your forum 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>
<a href="http://localhost-link/#disqus_thread"></a>
我發現'href'和'data-disqus-url'不適合我。我不得不使用帶有我的頁面ID的'data-disqus-identifier'。 – Harvey