gpt4 book ai didi

javascript - "We were unable to load Disqus."与 jekyll 的默认最小主题

转载 作者:行者123 更新时间:2023-12-02 13:12:59 26 4
gpt4 key购买 nike

设置时my personal blog使用 jekyll,我发现无法显示评论部分。它一直告诉我:

We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

相关代码:(完整代码请访问我的仓库:https://github.com/sunqingyao/sunqingyao.github.io)

_config.yml

disqus:
shortname: sled-dog

_layouts/post.html

{% if site.disqus.shortname %}
{% include disqus_comments.html %}
{% endif %}

disqus_comments.html

{% if page.comments != false and jekyll.environment == "production" %}

<div id="disqus_thread"></div>
<script>
var disqus_config = function () {
this.page.url = '{{ page.url | absolute_url }}';
this.page.identifier = '{{ page.url | absolute_url }}';
};
(function() {
var d = document, s = d.createElement('script');
s.src = 'https://{{ site.disqus.shortname }}.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" rel="nofollow">comments powered by Disqus.</a></noscript>
{% endif %}

我已通读 troubleshooting guide查了好几次了,各种可能的情况都查了一遍,还是没有出现评论。

需要注意的几点:

  1. 我正在使用 jekyll 的默认主题 minima,并遵循其 document .
  2. 我已注册 Disqus 帐户并验证了电子邮件地址。
  3. 我的网站简称是 sled-dog
  4. github.io 已添加到“受信任的域”。

最佳答案

令我惊讶的是,最好的答案是禁用 Discus.config。

如果您在使用默认 jekyll 主题的网站上启用 disqus 时遇到问题,请检查参数。

_config.yml 应包括:

disqus:
短名称:测试短名称

网址:http://yourwebsite.com

JEKYLL_ENV 应设置为“生产”

导出 JEKYLL_ENV=生产

这就是您所需要的。祝你好运。

关于javascript - "We were unable to load Disqus."与 jekyll 的默认最小主题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41613661/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com