Skip to content

Commit 6e8cfaf

Browse files
authored
Feat/add giscus comments1 (#627)
### What problem were solved in this pull request? Issue Number: close #598 Problem: 评论框已显示,但提交时报错 "Unable to create discussion"。 原因(可能):Giscus App 未安装在 `oceanbase/miniob` 仓库。 解决方法: 1. 打开 https://github.com/apps/giscus 2. 选择 oceanbase/miniob → 点击 Install 3. 授权 "Read and write to discussions" 安装后,功能如果生效,评论会写入 "Comments" 分类。
1 parent 03f4685 commit 6e8cfaf

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

docs/mkdocs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ nav:
7777

7878
theme:
7979
name: material
80+
custom_dir: overrides
8081
language: zh
8182
features:
8283
- search.highlight
@@ -143,3 +144,4 @@ extra_javascript:
143144
# - https://polyfill.io/v3/polyfill.min.js?features=es6
144145
- https://polyfill.alicdn.com/v3/polyfill.min.js?features=es6
145146
- https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
147+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!-- 原有页面内容 -->
2+
{{ page.content }}
3+
4+
<!-- Giscus 评论区 -->
5+
{% if page and page.meta and page.meta.comments != false %}
6+
{# 可选:如果 MD 文件开头有 --- comments: false ---,则隐藏 #}
7+
{% endif %}
8+
<h2 id="__comments">讨论区</h2>
9+
<div class="giscus"></div>
10+
11+
<!-- Giscus 脚本 -->
12+
<script src="https://giscus.app/client.js"
13+
data-repo="oceanbase/miniob"
14+
data-category="Comments"
15+
data-mapping="pathname"
16+
data-strict="0"
17+
data-reactions-enabled="1"
18+
data-emit-metadata="0"
19+
data-input-position="bottom"
20+
data-theme="preferred_color_scheme"
21+
data-lang="zh-CN"
22+
crossorigin="anonymous"
23+
async>
24+
</script>
25+
26+
<!-- 可选:自定义 CSS(嵌入 style 标签) -->
27+
<style>
28+
.giscus {
29+
margin-top: 2em;
30+
border: 1px solid #e1e4e8;
31+
border-radius: 8px;
32+
}
33+
.giscus-frame {
34+
width: 100%;
35+
height: 500px; /* 可调整高度 */
36+
}
37+
</style>

0 commit comments

Comments
 (0)