我创建了一个博客,我想把Disqus整合到这个网站上,这样人们就可以发表评论了。我按照Disqus网站上列出的步骤进行操作,直到我开始设置配置变量的部分。Disqus停止加载并显示。我不知道我在这里做错了什么。
下面是我的代码:
<div id="disqus_thread"></div>
<script>
var disqus_config = function ()
this.page.url = '<%= url_for([@post, {:only_path => false}]) %>'; // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = '<%= @post.id %>'; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
this.page.title = '<%= @post.title %>';
};
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = '//york-wang.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">comments powered by Disqus.</a></noscript>发布于 2016-09-10 01:40:37
经过几个小时的研究,我终于解决了这个问题。下面是我使用的代码:
<div id="disqus_thread"></div>
<script>
var disqus_config = function () {
s.src = '//YOURSHORTNAME.disqus.com/embed.js'; // IMPORTANT: Replace EXAMPLE with your forum shortname!
this.page.url = '<%= url_for(@post) %>';
this.page.identifier = '<%= @post.id %>';
this.page.title = '<%= @post.title %>';
};
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = '//YOURSHORTNAME.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">comments powered by Disqus.</a></noscript>发现了三个问题: 1.我没有正确地配置本地开发环境,以便将disqus连接起来。2.我正在使用一个过时的命令来绘制我的论坛“短名”的路径。3. this.page.url变量设置不正确。修复代码并将所有内容上载到生产服务器后,Disqus再次开始工作。
https://stackoverflow.com/questions/39419813
复制相似问题