Skip to content

Commit 821410d

Browse files
committed
feat: add giscus comment
1 parent 85eca6a commit 821410d

File tree

4 files changed

+2824
-653
lines changed

4 files changed

+2824
-653
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<template>
2+
<div style="margin-top: 24px">
3+
<Giscus
4+
:key="route.path"
5+
:theme="isDark ? 'dark' : 'light'"
6+
id="comments"
7+
repo="luckfunc/blog"
8+
repoid="R_kgDOIN2Meg"
9+
category="General"
10+
category-id="DIC_kwDOIrDrIs4ClpeT"
11+
mapping="pathname"
12+
term="Welcome to giscus!"
13+
reactionsenabled="1"
14+
emitmetadata="0"
15+
inputposition="top"
16+
loading="lazy"
17+
/>
18+
</div>
19+
</template>
20+
21+
<script setup>
22+
import Giscus from '@giscus/vue';
23+
import { useRoute, useData } from 'vitepress';
24+
25+
const route = useRoute();
26+
const { isDark } = useData();
27+
</script>

docs/.vitepress/theme/index.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1-
import Theme from "vitepress/theme";
1+
import { h } from 'vue';
2+
import Theme from 'vitepress/theme';
3+
import GiscusComment from './components/GiscusComment.vue';
24
import './style/custom.css';
35
import './style/var.css'
6+
47
export default {
5-
...Theme
8+
...Theme,
9+
Layout() {
10+
return h(Theme.Layout, null, {
11+
'doc-after': () => h(GiscusComment)
12+
})
13+
}
614
}

0 commit comments

Comments
 (0)