hexo主题maupassant没有集成giscus评论,需要手动增加

1、修改themes\maupassant\layout\_partial目录下的comments.pug,在下方增加

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
if theme.giscus.enable == true
#giscus-container
script(
src='https://giscus.app/client.js'
data-repo=theme.giscus.repo
data-repo-id=theme.giscus.repoId
data-category=theme.giscus.category
data-category-id=theme.giscus.categoryId
data-mapping=theme.giscus.mapping || 'pathname'
data-strict=theme.giscus.strict || '0'
data-reactions-enabled=theme.giscus.reactionsEnabled || '1'
data-emit-metadata=theme.giscus.emitMetadata || '0'
data-input-position=theme.giscus.inputPosition || 'top'
data-theme=theme.giscus.theme || 'light_tritanopia'
data-lang=theme.giscus.lang || 'zh-CN'
crossorigin='anonymous'
async
)

2、在主题配置文件themes\maupassant\_config.yml,twikoo配置后面增加,配置项按你实际情况填

gitcus的配置信息可以在Giscus 中文官网中生成,生成直接复制过来替换就行

1
2
3
4
5
6
7
8
9
10
11
12
13
giscus:
enable: true
repo: luohongzhan/comments-for-hexo #你的仓库名
repoId: R_kpDxxxigxh #仓库id
category: Announcements
categoryId: DIC_ksgdsgsgsgM2342Vw #分类id
mapping: pathname
strict: '0'
reactionsEnabled: '1'
emitMetadata: '0'
inputPosition: top
theme: light_tritanopia
lang: zh-CN