[通过RoR博客网站教程进行操作,但是我无法添加Disqus。它不喜欢我如何编写动态变量。所有这一切仍然很新。
<div id="disqus_thread"></div>
<script>
var disqus_config = function () {
this.page.url = '<%= url_for([@post, {only_path: false}]) %>';
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 = 'https://myshortname.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>
更新我注意到我的网址显示不正确。检查disqus javascript显示:
var disqus_config = function () {
this.page.url = '/posts/5'; //This should be a complete url
this.page.identifier = '5';
this.page.title = 'Article 5';
};
this.page.url = '<%= url_for(only_path: false) %>';