Skip to content

Commit

Permalink
feat: add giscus
Browse files Browse the repository at this point in the history
  • Loading branch information
zivenyang committed Sep 4, 2023
1 parent b9d249a commit 06038dc
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 6 deletions.
28 changes: 22 additions & 6 deletions .vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from 'vitepress'
import vuetify from 'vite-plugin-vuetify'
import { defineConfig } from "vitepress";
import vuetify from "vite-plugin-vuetify";

// https://vitepress.dev/reference/site-config
export default defineConfig({
Expand All @@ -8,14 +8,30 @@ export default defineConfig({
vite: {
plugins: [vuetify({ autoImport: true })],
ssr: {
noExternal: ['vuetify'],
noExternal: ["vuetify"],
},
},
base: '/vitepress-material3/',
base: "/vitepress-material3/",
markdown: {
headers: {
level: [2, 3],
}
},
},
appearance: false,
})
themeConfig: {
giscus: {
host: "https://giscus.app",
repo: "zivenyang/vitepress-material3",
repoId: "R_kgDOKOGqfQ",
category: "General",
categoryId: "DIC_kwDOKOGqfc4CZER1",
mapping: "pathname",
strict: "0",
reactionsEnabled: "1",
emitMetadata: "0",
inputPosition: "top",
lang: "zh-CN",
loading: "lazy",
},
},
});
11 changes: 11 additions & 0 deletions .vitepress/theme/components/PostContentContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,19 @@
<Content />
</v-col>
</v-row>
<v-row no-gutters class="fill-height align-middle">
<v-col>
<v-card variant="outlined" rounded="xl">
<PostGiscus></PostGiscus>
</v-card>
</v-col>
</v-row>
</v-container>
</template>
<script setup lang="ts">
import { useData } from 'vitepress'
import PostToc from '../components/PostToc.vue';
import PostGiscus from './PostGiscus.vue';
import { ref } from 'vue'
const data = useData();
const active = ref(0);
Expand All @@ -22,4 +30,7 @@ const active = ref(0);
min-width: 900px;
max-width: fit-content;
}
.v-card--variant-elevated{
background-color: unset;
}
</style>
13 changes: 13 additions & 0 deletions .vitepress/theme/components/PostGiscus.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<template>
<v-card :key="page.relativePath" class="giscus-card pa-4">
<Giscus v-bind="theme.giscus" theme="light" />
</v-card>
</template>

<script setup lang="ts">
import { useData } from 'vitepress'
import { BlogThemeConfig } from '../types/config'
import Giscus from '@giscus/vue'
const { page, theme } = useData<BlogThemeConfig>()
</script>

0 comments on commit 06038dc

Please sign in to comment.