Skip to content

Commit 95905ec

Browse files
update: create the element
1 parent e5e09e6 commit 95905ec

File tree

11 files changed

+238
-20
lines changed

11 files changed

+238
-20
lines changed

.github/workflows/deploy.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ jobs:
4545
uses: actions/configure-pages@v4
4646
- name: Install dependencies
4747
run: npm ci # 或 pnpm install / yarn install / bun install
48+
- name: generate config/env file
49+
env:
50+
GISCUS_TOKEN: ${{ secrets.GISCUS_CONFIG }}
51+
run: echo "$GISCUS_TOKEN" > ./src/.vitepress/config/env.js
4852
- name: Build with VitePress
4953
run: npm run docs:build # 或 pnpm docs:build / yarn docs:build / bun run docs:build
5054
- name: Upload artifact

.gitignore

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Node.js
2+
node_modules/
3+
npm-debug.log*
4+
yarn-debug.log*
5+
yarn-error.log*
6+
pnpm-debug.log*
7+
.bun
8+
9+
# Logs
10+
logs
11+
*.log
12+
*.log.*
13+
14+
# VitePress
15+
docs/.vitepress/dist
16+
docs/.vitepress/cache
17+
18+
# Editor directories and files
19+
.idea/
20+
.vscode/
21+
*.suo
22+
*.ntvs*
23+
*.njsproj
24+
*.sln
25+
26+
# MacOS
27+
.DS_Store
28+
29+
# Linux
30+
*~
31+
32+
# Windows
33+
Thumbs.db

docs/.vitepress/config.mjs

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { defineConfig } from 'vitepress'
2+
import sidebar from "./config/sidebar.js";
23

34
// https://vitepress.dev/reference/site-config
45
export default defineConfig({
@@ -21,28 +22,38 @@ export default defineConfig({
2122
},
2223
themeConfig: {
2324
// https://vitepress.dev/reference/default-theme-config
25+
logo: "https://avatars.githubusercontent.com/u/178354211?s=200&v=4",
2426
nav: [
2527
{ text: 'Home', link: '/' },
2628
{ text: 'Events', link: '/events/' },
2729
{ text: 'About', link: '/about.html' }
2830
],
29-
sidebar: [
30-
{
31-
'/events/': [
32-
{
33-
text: 'Event Materials',
34-
items: [
35-
{ text: 'AY2425', link: '/events/AY2425' }
36-
]
37-
}
38-
]
39-
}
40-
],
31+
sidebar: sidebar,
4132
search: {
4233
provider: 'local'
4334
},
4435
socialLinks: [
4536
{ icon: 'github', link: 'https://github.com/CompPsyUnion/' }
46-
]
37+
],
38+
footer: {
39+
message: "MIT Licensed",
40+
copyright: "Copyright © 2024-present CompPsyUnion",
41+
},
42+
docFooter: {
43+
prev: "上一页",
44+
next: "下一页",
45+
},
46+
editLink: {
47+
text: "在 GitHub 上编辑此页",
48+
pattern:
49+
"https://github.com/CompPsyUnion/CPU_Tech_Forum/edit/main/src/:path",
50+
},
51+
lastUpdated: {
52+
text: "最后更新于",
53+
formatOptions: {
54+
dateStyle: "short",
55+
timeStyle: "medium",
56+
},
57+
},
4758
}
4859
})

docs/.vitepress/config/env.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default {
2+
repo: "CompPsyUnion/CPU_Tech_Forum",
3+
repoId: "R_kgDONGcOZQ",
4+
category: "General",
5+
categoryId: "DIC_kwDONGcOZc4Cj5Hk",
6+
};

docs/.vitepress/config/sidebar.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export default [
2+
{
3+
items: [
4+
{ text: "AY2425", link: "/events/" },
5+
{ text: "241018", link: "/events/AY2425/241018" },
6+
{ text: "241101", link: "/events/AY2425/241101" },
7+
],
8+
},
9+
];

docs/.vitepress/theme/index.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
// .vitepress/theme/index.js
22
import DefaultTheme from 'vitepress/theme'
3+
import Layout from "./layout.vue";
34
import './custom.css'
45

5-
export default DefaultTheme
6+
export default {
7+
...DefaultTheme,
8+
Layout,
9+
async enhanceApp(ctx) {
10+
// extend default theme custom behaviour.
11+
DefaultTheme.enhanceApp(ctx);
12+
// register your custom global components
13+
},
14+
};

docs/.vitepress/theme/layout.vue

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<script setup>
2+
import {ref, watch} from "vue";
3+
import {useData, useRoute} from "vitepress";
4+
import DefaultTheme from "vitepress/theme";
5+
import envConfig from "../config/env.js";
6+
7+
const {Layout} = DefaultTheme;
8+
const {isDark} = useData();
9+
const isDev = import.meta.env.DEV;
10+
const route = useRoute();
11+
const showComment = ref(true);
12+
13+
watch(
14+
() => route.path,
15+
() => {
16+
// if (isDev){
17+
// showComment.value = false;
18+
// return;
19+
// }
20+
if (route.path === '/') {
21+
showComment.value = false;
22+
return;
23+
}
24+
showComment.value = false;
25+
setTimeout(() => {
26+
showComment.value = true;
27+
}, 200);
28+
},
29+
{
30+
immediate: true,
31+
}
32+
);
33+
</script>
34+
35+
<template>
36+
<Layout>
37+
<template #doc-after>
38+
<div v-if="showComment" style="padding-top: 24px">
39+
<component
40+
:key="route.path"
41+
is="script"
42+
src="https://giscus.app/client.js"
43+
data-id="comments"
44+
:data-repo="envConfig.repo"
45+
:data-repo-id="envConfig.repoId"
46+
:data-category="envConfig.category"
47+
:data-category-id="envConfig.categoryId"
48+
data-mapping="url"
49+
data-strict="1"
50+
data-reactions-enabled="1"
51+
data-emit-metadata="0"
52+
data-input-position="top"
53+
:data-theme="isDark ? 'dark' : 'light'"
54+
data-lang="zh-CN"
55+
data-crossorigin="anonymous"
56+
data-loading="lazy"
57+
async></component>
58+
</div>
59+
</template>
60+
</Layout>
61+
</template>

docs/events/AY2425/241018.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44

55
## 王修奇:Introduction to Git
66

7-
## 徐安植:Introduction to Git
7+
## 徐安植:Introduction to Git
8+

docs/events/index.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
---
2+
title: Events
3+
description: "Events"
4+
permalink: /events/
5+
---
6+
17
# Events Materials
28

3-
查看或下载活动材料。
9+
查看或下载活动材料。
10+

package-lock.json

Lines changed: 78 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)