diff --git a/.env.tmpl b/.env.tmpl
new file mode 100644
index 0000000..d9f5085
--- /dev/null
+++ b/.env.tmpl
@@ -0,0 +1,4 @@
+BASE_URL=/blog/
+# GISCUS Configs: generated from https://giscus.app/
+GISCUS_REPO_ID=
+GISCUS_CATEGORY_ID=
diff --git a/.github/contributing.md b/.github/contributing.md
index dda32b2..da73206 100644
--- a/.github/contributing.md
+++ b/.github/contributing.md
@@ -9,10 +9,16 @@ The version number is stored in this file: [`.nvmrc`](../.nvmrc).
After the corresponding [Node.js](https://nodejs.org/) is installed, run:
```sh
+# setup .env
+mv .env.tmpl .env
+# then fill out the .env
+
# install dependencies
npm install
+
# start the development server
npm run dev
+
# build static files for deployment
npm run build
```
diff --git a/.gitignore b/.gitignore
index c503442..c89f734 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
.DS_Store
+.env
.vitepress/dist
.vitepress/cache
node_modules
diff --git a/.vitepress/config.theme.ts b/.vitepress/config.theme.ts
index 784606c..6b517cf 100644
--- a/.vitepress/config.theme.ts
+++ b/.vitepress/config.theme.ts
@@ -1,7 +1,7 @@
import type { ThemeConfig } from "./theme/types/theme-config";
import { tokenize } from "./theme/search";
import emailSVGString from "./theme/svgs/email";
-import { withBaseURL } from "./config.utils";
+import { giscus, withBaseURL } from "./config.utils";
export default {
outline: "deep",
@@ -81,5 +81,6 @@ export default {
location: "Shenzhen, China",
timezone: "Asia/Shanghai",
pageSize: 13,
- mdfilePatterns: ["posts/**/*.md"]
+ mdfilePatterns: ["posts/**/*.md"],
+ giscus
} satisfies ThemeConfig;
diff --git a/.vitepress/config.utils.ts b/.vitepress/config.utils.ts
index 92bd1ca..d90dfd6 100644
--- a/.vitepress/config.utils.ts
+++ b/.vitepress/config.utils.ts
@@ -1,8 +1,14 @@
+import "dotenv/config";
import { env } from "process";
import * as path from "path";
export const BASE_URL = env.BASE_URL || undefined;
+export const giscus = {
+ repo_id: env.GISCUS_REPO_ID || "",
+ category_id: env.GISCUS_CATEGORY_ID || "",
+};
+
export function withBaseURL(urlPath: string) {
return path.join(BASE_URL || "/", urlPath);
}
diff --git a/.vitepress/theme/components/Comments.vue b/.vitepress/theme/components/Comments.vue
new file mode 100644
index 0000000..26975cb
--- /dev/null
+++ b/.vitepress/theme/components/Comments.vue
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
diff --git a/.vitepress/theme/components/PrevNext.vue b/.vitepress/theme/components/PrevNext.vue
index 419d1a1..41dc4ce 100644
--- a/.vitepress/theme/components/PrevNext.vue
+++ b/.vitepress/theme/components/PrevNext.vue
@@ -43,7 +43,7 @@ import { findPostIndex } from "../utils";
import type { PageControl } from "../types/page-control";
const { page, theme } = useData();
-let control = ref({});
+const control = ref({});
onContentUpdated(() => {
const index = findPostIndex(allPosts, page.value);
@@ -64,7 +64,7 @@ onContentUpdated(() => {