Skip to content

Commit

Permalink
chore: 使用 giscus 评论系统
Browse files Browse the repository at this point in the history
  • Loading branch information
mark9804 committed Nov 26, 2024
1 parent 89ddd99 commit 298dc54
Show file tree
Hide file tree
Showing 28 changed files with 125 additions and 73 deletions.
18 changes: 0 additions & 18 deletions docs/.vitepress/theme/components/deprecated/DiscusWidget.vue

This file was deleted.

31 changes: 0 additions & 31 deletions docs/.vitepress/theme/components/deprecated/DiscussionWidget.vue

This file was deleted.

42 changes: 34 additions & 8 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import { createPinia } from "pinia";
import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
import ArticleInfo from "./components/ArticleInfo.vue";
import { Image } from "@arco-design/web-vue";
import ImageGallery from "./components/ElysiumUI/ElyImageGallery.vue";
import { autoAnimatePlugin } from "@formkit/auto-animate/vue";
import ElyImageGallery from "./components/ElysiumUI/ElyImageGallery.vue";
import ElySpace from "./components/ElysiumUI/ElySpace.vue";
import giscusTalk from "vitepress-plugin-comment-with-giscus";
import { useData, useRoute } from "vitepress";
import type { App } from "vue";

import "@arco-design/web-vue/es/image/style/css.js";
import "@arco-design/web-vue/es/tooltip/style/css.js";
Expand All @@ -21,19 +23,43 @@ pinia.use(piniaPluginPersistedstate);
export default {
...Theme,
extends: Theme,
setup() {},
setup() {
const { frontmatter } = useData();
const route = useRoute();

// Giscus configuration
giscusTalk(
{
repo: "mark9804/blog",
repoId: "R_kgDOLo2yWA",
category: "Announcements",
categoryId: "DIC_kwDOLo2yWM4CknAK",
mapping: "title",
inputPosition: "top",
lang: "zh-CN",
loading: "lazy",
reactionsEnabled: "1",
emitMetadata: "0",
theme: "preferred_color_scheme",
},
{
frontmatter,
route,
},
true // 默认在所有页面启用评论
);
},
Layout: MainLayout,
// @ts-ignore
enhanceApp({ app, router, siteData }) {
app.use(pinia).use(autoAnimatePlugin);

enhanceApp({ app }: { app: App }) {
app.use(pinia);
Message._context = app._context;

// register your custom global components
// Space 组件已经在 ElyImageGallery 中使用了,会自动导入
app
.component("ArticleInfo", ArticleInfo)
.component("ArcoImage", Image)
.component("ElyImageGallery", ImageGallery)
.component("ElyImageGallery", ElyImageGallery)
.component("ElySpace", ElySpace);
},
};
4 changes: 0 additions & 4 deletions docs/.vitepress/theme/layouts/MainLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import { useData, withBase, useRoute } from "vitepress";
import { nextTick, onBeforeMount, provide, ComputedRef } from "vue";
import DefaultTheme from "vitepress/theme";
import DiscussionWidget from "../components/deprecated/DiscussionWidget.vue";
import type { ArticleInfo } from "../types/ArticleInfo";
import { useSearchTags } from "../utils/tagSearchUtils";
import { useCustomStore } from "../../piniaStore";
Expand Down Expand Up @@ -79,9 +78,6 @@ function handleTagClick(tag: string) {
</ElyTag>
</div>
</template>
<template #doc-after v-if="withBase('/') !== route.path">
<DiscussionWidget />
</template>
</Layout>
</template>
Expand Down
3 changes: 1 addition & 2 deletions docs/.vitepress/theme/styles/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ a.title span,
.pager-link .title,
.VPSidebarItem.is-active .text {
font-weight: 700;
font-family: "Wix Madefor", "HarmonyOS Sans SC Bold",
fonts.$font-family-base;
font-family: "Wix Madefor", "HarmonyOS Sans SC Bold", fonts.$font-family-base;
}

.vp-doc {
Expand Down
3 changes: 0 additions & 3 deletions docs/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ declare module 'vue' {
AImagePreviewGroup: typeof import('@arco-design/web-vue')['ImagePreviewGroup']
ArticleInfo: typeof import('./.vitepress/theme/components/ArticleInfo.vue')['default']
ArticleWaterfallList: typeof import('./.vitepress/theme/components/ArticleWaterfallList.vue')['default']
ASwitch: typeof import('@arco-design/web-vue')['Switch']
ATooltip: typeof import('@arco-design/web-vue')['Tooltip']
DiscussionWidget: typeof import('./.vitepress/theme/components/deprecated/DiscussionWidget.vue')['default']
DiscusWidget: typeof import('./.vitepress/theme/components/deprecated/DiscusWidget.vue')['default']
ElyButton: typeof import('./.vitepress/theme/components/ElysiumUI/ElyButton.vue')['default']
ElyCard: typeof import('./.vitepress/theme/components/ElysiumUI/ElyCard.vue')['default']
ElyImageGallery: typeof import('./.vitepress/theme/components/ElysiumUI/ElyImageGallery.vue')['default']
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ prev: false
next: false
title: 首页
publish: false
comment: false
---

<script setup>
Expand Down
1 change: 1 addition & 0 deletions docs/posts/algorithm/algo-applications/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
publish: false
comment: false
---

# 算法应用
1 change: 1 addition & 0 deletions docs/posts/algorithm/atcoder/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
publish: false
comment: false
---

# AtCoder
1 change: 1 addition & 0 deletions docs/posts/algorithm/cci-6/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
publish: false
comment: false
---

# Cracking the Coding Interview - 6th Edition
1 change: 1 addition & 0 deletions docs/posts/algorithm/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
publish: false
comment: false
---

# 算法
1 change: 1 addition & 0 deletions docs/posts/algorithm/leetcode/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
publish: false
comment: false
---

# LeetCode
1 change: 1 addition & 0 deletions docs/posts/algorithm/paiza/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
publish: false
comment: false
---

# Paiza
1 change: 1 addition & 0 deletions docs/posts/archive/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
publish: false
comment: false
---

# 归档文章
1 change: 1 addition & 0 deletions docs/posts/exam/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
publish: false
comment: false
---

# 资格测验和考试
1 change: 1 addition & 0 deletions docs/posts/exam/it-passport/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
publish: false
comment: false
---

# IT Passport
1 change: 1 addition & 0 deletions docs/posts/frontend/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
publish: false
comment: false
---

# 前端
1 change: 1 addition & 0 deletions docs/posts/life/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
publish: false
comment: false
---

# 生活
1 change: 1 addition & 0 deletions docs/posts/llm/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
publish: false
comment: false
---

# LLM
1 change: 1 addition & 0 deletions docs/posts/peripheral/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
publish: false
comment: false
---

# 数码外设
1 change: 1 addition & 0 deletions docs/posts/tools-and-workflows/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
publish: false
comment: false
---

# 工具与工作流
1 change: 1 addition & 0 deletions docs/posts/torture/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
publish: false
comment: false
---

# 折腾
1 change: 1 addition & 0 deletions docs/posts/works/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
publish: false
comment: false
---

# 翻译项目
1 change: 1 addition & 0 deletions docs/posts/works/play-therapy-with-children/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
publish: false
comment: false
---

# Play Theory with Children: Modalities for Change
1 change: 1 addition & 0 deletions docs/projects.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
publish: false
comment: false
outline: [2, 4]
createdAt: 1732558487000
---
Expand Down
1 change: 1 addition & 0 deletions docs/tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ prev: false
next: false
title: 搜索标签
publish: false
comment: false
---

<script setup>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"dependencies": {
"@arco-design/web-vue": "^2.55.1",
"@arco-plugins/vite-vue": "^1.4.5",
"@formkit/auto-animate": "^0.8.2",
"@icon-park/vue-next": "^1.4.2",
"@mdit/plugin-footnote": "^0.13.1",
"@mdit/plugin-img-size": "^0.13.0",
Expand Down Expand Up @@ -75,6 +74,7 @@
"sass": "^1.72.0",
"unplugin-icons": "^0.20.0",
"unplugin-vue-components": "^0.27.0",
"vitepress-plugin-comment-with-giscus": "^1.1.15",
"vitepress-plugin-rss": "^0.3.0",
"words-count": "^2.0.2"
}
Expand Down
Loading

0 comments on commit 298dc54

Please sign in to comment.