11// https://vitepress.dev/guide/custom-theme
22import { h , onMounted , watch , nextTick } from 'vue'
33import type { Theme } from 'vitepress'
4- import { inBrowser , useRoute } from 'vitepress'
4+ import { inBrowser , useData , useRoute } from 'vitepress'
55import DefaultTheme from 'vitepress/theme'
66import './style.css'
77import './style/index.css'
@@ -17,6 +17,7 @@ import HomeUnderline from './components/HomeUnderline.vue'
1717import TeamCard from './components/TeamCard.vue'
1818import Download from './components/Download.vue'
1919import Donate from './components/Donate.vue'
20+ import giscusTalk from 'vitepress-plugin-comment-with-giscus'
2021
2122export default {
2223 extends : DefaultTheme ,
@@ -53,5 +54,26 @@ export default {
5354 ( ) => route . path ,
5455 ( ) => nextTick ( ( ) => initZoom ( ) )
5556 ) ;
57+ // Get frontmatter and route
58+ const { frontmatter } = useData ( ) ;
59+
60+ // giscus配置
61+ giscusTalk ( {
62+ repo : 'SECTL/SecRandom-docs' , //仓库
63+ repoId : 'R_kgDOPRYlZg' , //仓库ID
64+ category : 'General' , // 讨论分类
65+ categoryId : 'DIC_kwDOPRYlZs4CvPMD' , //讨论分类ID
66+ mapping : 'pathname' ,
67+ inputPosition : 'bottom' ,
68+ lang : 'zh-CN' ,
69+ } ,
70+ {
71+ frontmatter, route
72+ } ,
73+ //默认值为true,表示已启用,此参数可以忽略;
74+ //如果为false,则表示未启用
75+ //您可以使用“comment:true”序言在页面上单独启用它
76+ true
77+ ) ;
5678 }
5779} satisfies Theme
0 commit comments