【问题标题】:Jekyll and Disqus: cannot get disqus to appear on siteJekyll 和 Disqus:无法让 disqus 出现在网站上
【发布时间】:2016-03-08 05:49:24
【问题描述】:

我正在使用 Github Pages 的 Jekyll 集成。我今天添加了 Disqus 配置,但 Disqus 没有出现在我的帖子中。我已将 Disqus 脚本添加到文件 _includes/disqus.html 中,并将 {% include disqus.html %} 添加到 _layouts/default.html。

您可以在我的https://github.com/shaneoston72/shaneoston72.github.io查看此作品

感谢您提供的任何帮助。

【问题讨论】:

  • 我不明白。 {% if page.comments %}{% endif %} 应该去哪里?我只有 markdown 博客文章...我不明白我的 markdown 内容在哪里...

标签: jekyll github-pages disqus


【解决方案1】:

好的,我们需要在这里做一些事情:

在你的文件末尾_layouts/default.html 我看到的是:

 </div>
    {% include disqus.html %}
    {% include footer.html %}   
  </body>

将此部分替换为:

 </div>
    {% include footer.html %}
    {% if page.comments %}
    {% include disqus.html %}
    {% endif %}
  </body>

然后,在您的文件_includes/disqus.html 上,删除第一行和最后一行:

{% if post.comments %}
.....
{% endif %}

这应该可以完成工作。告诉我进展如何,好吗?

希望有所帮助!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-08-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多