Giscus 并进行以下配置:
Polly2014/polly2014.github.io
。pathname
,将讨论与博客页面进行映射。zh-CN
(中文)。复制生成的嵌入代码。
templates
文件夹中的 blog.html
模板文件。<div class="giscus"></div>
<link rel="stylesheet" href="/static/css/style_new.css">
<script src="https://giscus.app/client.js"
data-repo="Polly2014/polly2014.github.io"
data-repo-id="R_kgDOL45duA"
data-category="Announcements"
data-category-id="DIC_kwDOL45duM4CnjaK"
data-mapping="pathname"
data-strict="0"
data-reactions-enabled="1"
data-emit-metadata="0"
data-input-position="bottom"
data-theme="light"
data-lang="zh-CN"
data-loading="lazy"
crossorigin="anonymous"
async>
</script>
static/css
文件夹中的 style_new.css
文件。.giscus {
background-color: #f2f2f2;
font-family: Arial, sans-serif;
color: #333;
padding: 20px;
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
margin-top: 20px;
}
.giscus-frame {
border: none;
width: 100%;
}
public
文件夹推送到 polly2014.github.io
仓库。除了 Giscus,以下是其他常见评论系统的对比:
评论系统 | 特点 | 优点 | 缺点 |
---|---|---|---|
Giscus | 基于 GitHub Discussions,支持 Markdown 和多语言。 | 免费、无广告、与 GitHub 集成。 | 需要 GitHub 账号,适合技术博客。 |
Disqus | 流行的第三方评论系统,支持社交登录。 | 易于集成,功能丰富。 | 免费版有广告,隐私性较差。 |
Commento | 开源评论系统,可自托管。 | 无广告,隐私性好。 | 自托管需要服务器资源。 |
Remark42 | 开源自托管,支持匿名评论和社交登录。 | 无广告,支持多种登录方式。 | 自托管需要维护,功能较简单。 |
Utterances | 基于 GitHub Issues,轻量化。 | 免费、无广告、与 GitHub 集成。 | 需要 GitHub 账号,功能较简单。 |
通过本文的步骤,即可轻松在 Zola 博客中集成 Giscus 评论系统,并为用户提供现代化的互动体验。根据你的需求,也可以选择其他评论系统。
欢迎在评论区分享你的想法或提出问题!