利用 GitLab Work Items 实现的评论系统,让访客借助 GitLab 在你的网站上留下评论和反应吧!本项目深受 utterances 的启发。
注意:giscus 仍处于活跃开发中,GitLab 也还在活跃地开发 Work Items 及其 API,因此一些 giscus 的特性可能随时间损坏或变更。
giscus 加载时,会使用 GitLab Work Items 搜索 API 根据选定的映射方式(如 URL、pathname、<title> 等)来查找与当前页面关联的 Work Item。如果找不到匹配的 Work Item,giscus bot 就会在第一次有人留下评论或回应时自动创建一个 Work Item。
pathname
<title>
访客如果想要评论,必须通过 GitLab OAuth 授权 giscus 代表他发布,或者可以直接在 GitLab Work Item 里评论。你可以在 GitLab 上管理评论。
这是 giscus 的 GitLab 移植版。评论将作为带有指定 Label 的 Work Items 存储在指定仓库中。
显示原有 Giscus 评论界面。
在 HTML5 视频上覆盖时间同步弹幕,并显示独立弹幕面板。
选择 giscus 的显示语言。找不到你的语言?贡献一个吧。
选择 giscus 连接到的仓库。请确保:
一个公开的 GitLab 仓库。Work Items 将存储在该仓库中。
选择页面与嵌入的 Work Item 之间的映射关系。
giscus 将查找标题中包含页面 URL 的 pathname 部分的 Work Item。
URL
giscus 将查找标题中包含页面 URL 的 Work Item。
giscus 将查找标题中包含页面的 <title> 标签的 Work Item。
og:title
giscus 将查找标题中包含页面的 <meta property="og:title"> 标签的 Work Item。
<meta property="og:title">
giscus 将查找标题中包含特定字符串的 Work Item。
giscus 将按编号加载指定的 Work Item。该选项不支持自动创建 Work Item。
严格模式会同时匹配 Work Item 标题与描述中的 SHA-1 标记,避免相似标题之间发生错误匹配。更多细节请查看文档。
选择要添加到新 Work Items 的 Label。 建议选择一个<strong>专用 Label</strong>,它会添加到所有新 Work Items 上。
搜索匹配的 Work Item 时,giscus 只会在带有此 Label 的 Work Items 中搜索。
选择是否启用某些特性。
Work Item 主帖的回应将显示在评论之前。
Work Item 元数据将定期发送到父窗口(嵌入 giscus 的页面)。作为演示,可启用此选项并在此页面打开浏览器控制台。更多细节请查看文档。
评论输入框会放在评论上方,这样用户无需滚动到 Work Item 底部即可发表评论。
评论的加载将延迟到用户滚动到评论容器附近。 这是通过将 loading="lazy" 添加到 <iframe> 元素来完成的。
loading="lazy"
<iframe>
选择适合你网站的主题。找不到合适的?贡献一个新主题吧。
在你想让评论出现的位置添加以下 <script> 标签。但如果已经存在带有 giscus 类的元素,则评论会被放在那里。
<script>
giscus
<script src="https://giscus-gitlab.tigergod.workers.dev/client.js" data-repo="[在此输入仓库]" data-repo-id="[在此输入仓库 ID]" data-category="[在此输入 Label 名称]" data-category-id="[在此输入 Label ID]" data-mapping="pathname" data-strict="0" data-reactions-enabled="1" data-emit-metadata="0" data-input-position="bottom" data-theme="preferred_color_scheme" data-lang="zh-CN" crossorigin="anonymous" async> </script>
你可以在嵌入的页面中使用 .giscus 和 .giscus-frame 选择器来自定义容器布局。
.giscus
.giscus-frame
如果你使用了 giscus,请考虑在 GitHub 上 star 🌟 giscus 并为你的仓库添加 giscus 话题!🎉
你可以依照高级用法指南添加额外配置(例如:仅允许特定来源的请求)。在嵌入配置中,data-repo 应填写 GitLab 项目路径,例如 group/subgroup/project;data-category 是 Label 名称,data-category-id 是 Label GID。按编号映射时,data-term 应填写 Work Item IID。
data-repo
group/subgroup/project
data-category
data-category-id
data-term
如果想要在 React、Vue 和 Svelte 中使用 giscus,请查看 giscus 组件库。
如果你使用过其他基于 issue 的评论系统(如 utterances、gitalk),你可以将已有的 issue 迁移为 GitLab Work Items。迁移后,只要确保这些 Work Items 带有配置的 Label,且 Work Item 标题与页面的映射关系正确,giscus 就会自动使用它们。
请参阅 CONTRIBUTING.md。
giscus
利用 GitLab Work Items 实现的评论系统,让访客借助 GitLab 在你的网站上留下评论和反应吧!本项目深受 utterances 的启发。
它如何运作
giscus 加载时,会使用 GitLab Work Items 搜索 API 根据选定的映射方式(如 URL、
pathname、<title>等)来查找与当前页面关联的 Work Item。如果找不到匹配的 Work Item,giscus bot 就会在第一次有人留下评论或回应时自动创建一个 Work Item。访客如果想要评论,必须通过 GitLab OAuth 授权 giscus 代表他发布,或者可以直接在 GitLab Work Item 里评论。你可以在 GitLab 上管理评论。
配置
这是 giscus 的 GitLab 移植版。评论将作为带有指定 Label 的 Work Items 存储在指定仓库中。
显示模式
语言
选择 giscus 的显示语言。找不到你的语言?贡献一个吧。
仓库
选择 giscus 连接到的仓库。请确保:
页面 ↔️ Work Items 映射关系
选择页面与嵌入的 Work Item 之间的映射关系。
严格模式会同时匹配 Work Item 标题与描述中的 SHA-1 标记,避免相似标题之间发生错误匹配。更多细节请查看文档。
Work Item Label
选择要添加到新 Work Items 的 Label。 建议选择一个<strong>专用 Label</strong>,它会添加到所有新 Work Items 上。
搜索匹配的 Work Item 时,giscus 只会在带有此 Label 的 Work Items 中搜索。
特性
选择是否启用某些特性。
Work Item 主帖的回应将显示在评论之前。
Work Item 元数据将定期发送到父窗口(嵌入 giscus 的页面)。作为演示,可启用此选项并在此页面打开浏览器控制台。更多细节请查看文档。
评论输入框会放在评论上方,这样用户无需滚动到 Work Item 底部即可发表评论。
评论的加载将延迟到用户滚动到评论容器附近。 这是通过将
loading="lazy"添加到<iframe>元素来完成的。主题
选择适合你网站的主题。找不到合适的?贡献一个新主题吧。
启用 giscus
在你想让评论出现的位置添加以下
<script>标签。但如果已经存在带有giscus类的元素,则评论会被放在那里。你可以在嵌入的页面中使用
.giscus和.giscus-frame选择器来自定义容器布局。如果你使用了 giscus,请考虑在 GitHub 上 star 🌟 giscus 并为你的仓库添加
giscus话题!🎉高级用法
你可以依照高级用法指南添加额外配置(例如:仅允许特定来源的请求)。在嵌入配置中,
data-repo应填写 GitLab 项目路径,例如group/subgroup/project;data-category是 Label 名称,data-category-id是 Label GID。按编号映射时,data-term应填写 Work Item IID。如果想要在 React、Vue 和 Svelte 中使用 giscus,请查看 giscus 组件库。
迁移
如果你使用过其他基于 issue 的评论系统(如 utterances、gitalk),你可以将已有的 issue 迁移为 GitLab Work Items。迁移后,只要确保这些 Work Items 带有配置的 Label,且 Work Item 标题与页面的映射关系正确,giscus 就会自动使用它们。
正在使用 giscus 的网站
献一份力
请参阅 CONTRIBUTING.md。
试一试 👇👇👇