Skip to content

Commit

Permalink
增加评论功能
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzhongjia committed Dec 16, 2023
1 parent db65dfa commit 28305a5
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
Binary file modified bun.lockb
Binary file not shown.
35 changes: 32 additions & 3 deletions learn/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
// .vitepress/theme/index.js
import DefaultTheme from "vitepress/theme";
import "./style.css";
import DefaultTheme from 'vitepress/theme';
import giscusTalk from 'vitepress-plugin-comment-with-giscus';
import { useData, useRoute } from 'vitepress';

export default DefaultTheme;
export default {
...DefaultTheme,
enhanceApp(ctx) {
DefaultTheme.enhanceApp(ctx);
},
setup() {
// Get frontmatter and route
const { frontmatter } = useData();
const route = useRoute();

// Obtain configuration from: https://giscus.app/
giscusTalk({
repo: 'learnzig/learnzig',
repoId: 'R_kgDOKRsb5Q',
category: 'Comments', // default: `General`
categoryId: 'DIC_kwDOKRsb5c4Cbx2i',
mapping: 'pathname', // default: `pathname`
inputPosition: 'top', // default: `top`
lang: 'zh-CN', // default: `zh-CN`
strict: "1",
reactionsEnabled: "1",
theme: "preferred_color_scheme",
}, {
frontmatter, route
},
true
);
}
};
Empty file removed learn/.vitepress/theme/style.css
Empty file.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@
"medium-zoom": "^1.0.8",
"prettier": "^3.0.3",
"vitepress": "^1.0.0-rc.11"
},
"dependencies": {
"vitepress-plugin-comment-with-giscus": "^1.1.11"
}
}

0 comments on commit 28305a5

Please sign in to comment.