<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Blog on Awshgreen</title><link>https://awshgreen.top/tags/blog/</link><description>Recent content in Blog on Awshgreen</description><generator>Hugo</generator><language>zh-cn</language><lastBuildDate>Mon, 23 Feb 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://awshgreen.top/tags/blog/index.xml" rel="self" type="application/rss+xml"/><item><title>怎么在你的博客上添加讨论区</title><link>https://awshgreen.top/posts/blog-discussions-support/</link><pubDate>Mon, 23 Feb 2026 00:00:00 +0000</pubDate><guid>https://awshgreen.top/posts/blog-discussions-support/</guid><description>&lt;h2 id="前言">前言&lt;/h2>
&lt;p>有了你自己的博客 没有讨论区可怎么行 自己写一个讨论区要费老鼻子劲(反正我懒我不想自己动手 而且我也没学会html和css)&lt;/p>
&lt;p>那当然是找一下有没有现成的模板喽&lt;/p>
&lt;p>我替你找到了一个 名字就是 &lt;strong>giscus&lt;/strong>&lt;/p>
&lt;h2 id="前置条件">前置条件&lt;/h2>
&lt;ul>
&lt;li>一个&lt;strong>公开的&lt;/strong> GitHub 仓库（专门用来存评论，建议新建一个比如 &lt;code>blog-comments&lt;/code>）&lt;/li>
&lt;li>在仓库 Settings → Features 里勾选 &lt;strong>Discussions&lt;/strong>&lt;/li>
&lt;li>安装 &lt;a href="https://github.com/apps/giscus">giscus GitHub App&lt;/a> 并授权该仓库&lt;/li>
&lt;/ul>
&lt;h2 id="怎么使用">怎么使用&lt;/h2>
&lt;p>本文基于我的网页生成器(hugo)如果你的网页生成器与我不同 请自行查询操作 我只在此提供giscus项目使用方法&lt;/p>
&lt;p>前往giscus项目主页 链接在这里(别忘了来个star) &lt;a href="https://github.com/giscus/giscus">https://github.com/giscus/giscus&lt;/a>&lt;/p>
&lt;p>点击关于下面的链接(要是懒得去 点击这个也行) &lt;a href="https://giscus.app/zh-CN">giscus.app&lt;/a>&lt;/p>
&lt;ul>
&lt;li>进去后往下拉 你会看到配置页面&lt;/li>
&lt;li>先选择giscus的显示语言 支持简体中文&lt;/li>
&lt;li>下一步就是输入giscus连接的仓库 giscus依赖的是github官方项目讨论区 我非常强烈的建议你&lt;strong>单独&lt;/strong>为其建一个新仓库 不需要链接 只需要你的github用户名和仓库名就可以&lt;/li>
&lt;li>然后下面的映射关系一般选第一个就行(我其实也没看懂() )&lt;/li>
&lt;li>再往下 这里让你选择讨论区分类 跟着它推荐的公告（announcements）类型 这样就可以确保新 discussion 只能由仓库维护者和 giscus 创建 防止别人去你仓库底下乱评论&lt;/li>
&lt;li>再下面的特性选项按你自己要求来&lt;/li>
&lt;li>主题看你自己喜欢哪个选哪个&lt;/li>
&lt;li>重头戏来了 启用giscus这个区域里面的就是根据你的选项生成的html&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>注意!!! 接下来的教程是根据hugo写的 其他网页生成器怎么使用可以自己去查或者问ai&lt;/strong>&lt;/p>
&lt;h2 id="添加到-hugo">添加到 Hugo&lt;/h2>
&lt;p>新建评论模板（不要改主题文件，在项目根目录覆盖）：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>mkdir -p layouts/partials
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>nano layouts/partials/comments.html
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>把生成的script 粘进去保存。&lt;/p>
&lt;p>然后在 &lt;code>hugo.toml&lt;/code> 的 &lt;code>[params]&lt;/code> 下加一行：&lt;/p></description></item></channel></rss>