Disqus`count.js`对生产显示'0评论'

时间:2012-08-21 18:05:22

标签: comments ruby-on-rails-3.2 disqus

我的index页面上的评论计数并未反映我博客中每个entry的实际计数。在development中本地运行时,它会反映实际计数,但是一旦我将其推送到Heroku production,它就会显示“0评论和0反应”,即使至少有一条评论。我在index.html.haml的底部添加了Disqus提供的JS,并添加了评论计数的链接。这是我的审查代码:

%p
  = "* Comments - "
  = link_to e, entry_path(e, :anchor => "disqus_thread")
.date= e.updated_at.strftime('* %a, %b %-e, %Y @ %l:%M %p %Z') 
%br

:javascript
  /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
  var disqus_shortname = 'heneman'; // 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 = 'http://' + disqus_shortname + '.disqus.com/count.js';
    (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
  }());

此外,here是我博客的链接。如果您查看第二个条目(标题为“添加Markdown到A Rails 3.2应用程序”),您会看到评论计数显示为“0”,但如果您单击标题并进入show页面那个条目,你会看到有评论。

还有其他人遇到过这个吗?

1 个答案:

答案 0 :(得分:1)

尝试在here所述的评论链接中添加disqus-identifier data-disqus-identifier。查看起始页面的首页HTML源代码。它为每个帖子呈现<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><body>,这不是我认为的标准。