Skip to content

Commit 0870774

Browse files
committed
giscus 변경 및 의존 패키지 업데이트
1 parent 8b9602c commit 0870774

5 files changed

Lines changed: 3024 additions & 811 deletions

File tree

docs/.vitepress/config.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,16 @@ export default deepmerge(mergeConfig, defineConfig({
206206
search: {
207207
provider: 'local'
208208
},
209+
210+
lastUpdated: {
211+
formatOptions: {
212+
dateStyle: 'long',
213+
timeStyle: undefined,
214+
}
215+
},
216+
217+
externalLinkIcon: true,
218+
209219
editLink: {
210220
pattern: 'https://github.com/g5guide/g5guide.github.io/edit/main/docs/:path',
211221
text: '이 페이지 수정하기'

docs/.vitepress/theme/Comment.vue

Lines changed: 0 additions & 38 deletions
This file was deleted.

docs/.vitepress/theme/index.js

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import { h, watch } from 'vue'
1+
import { h, watch, toRefs } from 'vue'
2+
import { useData, useRoute } from 'vitepress';
23
import DefaultTheme from 'vitepress/theme'
3-
import Comment from './Comment.vue'
44
import { enhanceAppWithTabs } from 'vitepress-plugin-tabs/client'
5+
import giscusTalk from 'vitepress-plugin-comment-with-giscus';
56
import googleAnalytics from 'vitepress-plugin-google-analytics'
67

7-
import { useData, useRoute, useRouter } from 'vitepress';
8-
98
import './style.css'
109
import "vitepress-markdown-timeline/dist/theme/index.css";
1110

@@ -20,37 +19,35 @@ export default {
2019
})
2120
},
2221
Layout() {
23-
const { isDark } = useData();
24-
const route = useRoute();
25-
const router = useRouter();
26-
27-
if (process.env.NODE_ENV === 'production') {
28-
watch(route, (path) => {
29-
const el = document.querySelector('giscus-widget');
30-
if (el) {
31-
el.update();
32-
}
33-
34-
if (window.gtag) {
35-
gtag('send', 'pageview', path);
36-
}
37-
}, { immediate: true });
38-
39-
watch(isDark, (dark) => {
40-
const el = document.querySelector('giscus-widget');
41-
if (el) {
42-
el.theme = dark ? 'transparent_dark' : 'light';
43-
}
44-
});
45-
46-
return h(DefaultTheme.Layout, null, {
47-
'doc-footer-before': () => h(Comment, { theme: isDark.value ? 'transparent_dark' : 'light' })
48-
})
49-
}
50-
5122
return h(DefaultTheme.Layout, null, {
52-
'doc-footer-before': () => h('p', { style: 'text-align: center; font-size: 0.625rem;' }, ['댓글 출력 위치. (docs:dev 환경에서는 댓글을 출력하지 않음)'])
5323
});
24+
},
25+
setup() {
26+
// Get frontmatter and route
27+
const { frontmatter } = toRefs(useData());
28+
const route = useRoute();
29+
30+
// Obtain configuration from: https://giscus.app/
31+
giscusTalk({
32+
repo: 'g5guide/g5guide.github.io',
33+
repoId: 'R_kgDOJ55vGA',
34+
category: 'Comments', // default: `General`
35+
categoryId: 'DIC_kwDOJ55vGM4CX0n5',
36+
mapping: 'pathname', // default: `pathname`
37+
inputPosition: 'top', // default: `top`
38+
lang: 'ko', // default: `zh-CN`
39+
lightTheme: 'light', // default: `light`
40+
darkTheme: 'transparent_dark', // default: `transparent_dark`
41+
// ...
42+
}, {
43+
frontmatter, route
44+
},
45+
// Whether to activate the comment area on all pages.
46+
// The default is true, which means enabled, this parameter can be ignored;
47+
// If it is false, it means it is not enabled.
48+
// You can use `comment: true` preface to enable it separately on the page.
49+
true
50+
);
5451
}
5552
}
5653

0 commit comments

Comments
 (0)