Octopress: We were unable to load Disqus

最近闲着手头无聊,看着日剧选了一个.im的域名,手一贱,点了下paypal支付没想到就入了,因为原想着paypal里面没有余额,本来只想点下支付看它会报什么错误,次奥啊…不过也就8.99刀…

书归正传,既然入了域名,就换呗,几百年没有更新的github Page也折腾起来, DNS换完,github加了CNAME文件,睡了一觉搬家完成,但发现disqus不能用了总是显示

DISQUS seems to be taking longer than usual. We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

在网上搜了一下,翻出来都是两年前的帖子,于是自己看了下源代码,在我生成的某个post里disqus的代码是这样的

1
2
3
4
5
6
7
8
9
10
11
var disqus_shortname = 'ikumo-shortname';
// var disqus_developer = 1;
var disqus_identifier = 'ikumo.im/blog/2013/01/08/a-letter-to-daughter/';
var disqus_url = 'ikumo.im/blog/2013/01/08/a-letter-to-daughter/';
var disqus_script = 'embed.js';

(function () {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/' + disqus_script;
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
}());

感觉没有明显错误,查看octorpress里 \source\_includes\disqus.html信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
var disqus_shortname = 'ikumo-shortname';
% if page.comments == true %
% comment % `page.comments` can be only be set to true on pages/posts, so we embed the comments here. % endcomment %
// var disqus_developer = 1;
var disqus_identifier = '{{ site.url }}{{ page.url }}';
var disqus_url = '{{ site.url }}{{ page.url }}';
var disqus_script = 'embed.js';
% else %
% comment % As `page.comments` is empty, we must be on the index page. % endcomment %
// var disqus_script = 'count.js';
% endif %
(function () {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/' + disqus_script;
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
}());

仿照disqus里的example将function里disqus_script注释掉,直接使用字符串embed.js再重新generate和deploy就可以了, 目测是没有评论时count.js出错。

赞赏是最好的支持与鼓励!