diff --git a/README.en.md b/README.en.md
index 1264a5a38..1208ec9ae 100644
--- a/README.en.md
+++ b/README.en.md
@@ -13,6 +13,6 @@ English | [中文](./README.md)
-📝 **This is the charles's personal knowledge repositories website.**
+📝 **This is the charles's personal technology knowledge repositories website.**
🐢 [GitHub Pages](https://blog.charles7c.top) | 🐇 [Gitee Pages](https://charles7c.gitee.io)
diff --git a/README.md b/README.md
index bb91c20a6..2c48f0445 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@
-📝 **查尔斯的个人知识库,记录 & 分享个人碎片化、结构化、体系化的知识内容。**
+📝 **查尔斯的个人技术知识库,记录 & 分享个人碎片化、结构化、体系化的技术知识内容。**
🐢 [GitHub Pages(完整体验)](https://blog.charles7c.top) | 🐇 [Gitee Pages(无法评论)](https://charles7c.gitee.io)
diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts
index 474501a11..1e0163889 100644
--- a/docs/.vitepress/config.ts
+++ b/docs/.vitepress/config.ts
@@ -1,9 +1,9 @@
-import { defineConfig } from 'vitepress'
-import { metaData } from './config/constants'
-import { head } from './config/head'
-import { markdown } from './config/markdown'
-import { themeConfig } from './config/theme'
-import { withMermaid } from 'vitepress-plugin-mermaid'
+import { defineConfig } from 'vitepress';
+import { withMermaid } from 'vitepress-plugin-mermaid';
+import { metaData } from './config/constants';
+import { head } from './config/head';
+import { markdown } from './config/markdown';
+import { themeConfig } from './config/theme';
export default withMermaid(
defineConfig({
@@ -11,11 +11,11 @@ export default withMermaid(
title: metaData.title,
description: metaData.description,
- cleanUrls: 'without-subfolders',
+ cleanUrls: true,
lastUpdated: true, // 显示最后更新时间
head, //
内标签配置
markdown: markdown, // Markdown配置
- themeConfig // 主题配置
- })
-)
\ No newline at end of file
+ themeConfig, // 主题配置
+ }),
+);
\ No newline at end of file
diff --git a/docs/.vitepress/config/constants.ts b/docs/.vitepress/config/constants.ts
index 6afd8d880..85b795ef1 100644
--- a/docs/.vitepress/config/constants.ts
+++ b/docs/.vitepress/config/constants.ts
@@ -1,10 +1,10 @@
-const site = 'https://blog.charles7c.top'
+const site = 'https://blog.charles7c.top';
export const metaData = {
lang: 'zh-CN',
locale: 'zh_CN',
title: '查尔斯的知识库',
- description: '个人知识库,记录 & 分享个人碎片化、结构化、体系化的知识内容。',
+ description: '个人技术知识库,记录 & 分享个人碎片化、结构化、体系化的技术知识内容。',
site,
- image: `${site}/logo.jpg`
-}
\ No newline at end of file
+ image: `${site}/logo.jpg`,
+};
\ No newline at end of file
diff --git a/docs/.vitepress/config/head.ts b/docs/.vitepress/config/head.ts
index b6e311277..52a8868dc 100644
--- a/docs/.vitepress/config/head.ts
+++ b/docs/.vitepress/config/head.ts
@@ -1,5 +1,5 @@
-import type { HeadConfig } from 'vitepress'
-import { metaData } from './constants'
+import type { HeadConfig } from 'vitepress';
+import { metaData } from './constants';
export const head: HeadConfig[] = [
['link', { rel: 'icon', href: '/favicon.ico' }],
@@ -56,4 +56,4 @@ export const head: HeadConfig[] = [
xhr.open('GET', 'https://api.charles7c.top/blog/pv?pageUrl=' + location.href);
xhr.send();
}`]
-]
\ No newline at end of file
+];
\ No newline at end of file
diff --git a/docs/.vitepress/config/markdown.ts b/docs/.vitepress/config/markdown.ts
index a782ffcc6..7b7f2e163 100644
--- a/docs/.vitepress/config/markdown.ts
+++ b/docs/.vitepress/config/markdown.ts
@@ -1,4 +1,4 @@
-import type { MarkdownOptions } from 'vitepress'
+import type { MarkdownOptions } from 'vitepress';
export const markdown: MarkdownOptions = {
// Shiki主题, 所有主题参见: https://github.com/shikijs/shiki/blob/main/docs/themes.md
@@ -11,9 +11,9 @@ export const markdown: MarkdownOptions = {
// 在所有文档的标签后添加组件
config: (md) => {
md.renderer.rules.heading_close = (tokens, idx, options, env, slf) => {
- let htmlResult = slf.renderToken(tokens, idx, options, env, slf)
- if (tokens[idx].tag === 'h1') htmlResult += `\n`
- return htmlResult
+ let htmlResult = slf.renderToken(tokens, idx, options);
+ if (tokens[idx].tag === 'h1') htmlResult += `\n`;
+ return htmlResult;
}
- }
-}
\ No newline at end of file
+ },
+};
\ No newline at end of file
diff --git a/docs/.vitepress/config/nav.ts b/docs/.vitepress/config/nav.ts
index 974141b2c..1b147947f 100644
--- a/docs/.vitepress/config/nav.ts
+++ b/docs/.vitepress/config/nav.ts
@@ -1,4 +1,4 @@
-import DefaultTheme from 'vitepress/theme'
+import type { DefaultTheme } from 'vitepress';
export const nav: DefaultTheme.Config['nav'] = [
{
@@ -37,5 +37,5 @@ export const nav: DefaultTheme.Config['nav'] = [
{ text: '关于我', link: '/about/me', activeMatch: '/about/me' }
],
activeMatch: '/about/' // // 当前页面处于匹配路径下时, 对应导航菜单将突出显示
- }
-]
\ No newline at end of file
+ },
+];
\ No newline at end of file
diff --git a/docs/.vitepress/config/sidebar.ts b/docs/.vitepress/config/sidebar.ts
index 9dea540ac..c5f8b6e55 100644
--- a/docs/.vitepress/config/sidebar.ts
+++ b/docs/.vitepress/config/sidebar.ts
@@ -1,6 +1,6 @@
-import DefaultTheme from 'vitepress/theme'
-import { sync } from 'fast-glob'
-import matter from 'gray-matter'
+import type { DefaultTheme } from 'vitepress';
+import { sync } from 'fast-glob';
+import * as matter from 'gray-matter';
export const sidebar: DefaultTheme.Config['sidebar'] = {
'/categories/issues/': getItemsByDate("categories/issues"),
@@ -10,7 +10,7 @@ export const sidebar: DefaultTheme.Config['sidebar'] = {
'/courses/java/': getItems("courses/java"),
'/courses/mysql/': getItems("courses/mysql"),
- '/courses/mybatis/': getItems("courses/mybatis")
+ '/courses/mybatis/': getItems("courses/mybatis"),
}
/**
@@ -19,57 +19,56 @@ export const sidebar: DefaultTheme.Config['sidebar'] = {
* /categories/issues/2022/07/20/xxx.md
*
* @param path 扫描基础路径
- * @returns {DefaultTheme.SidebarGroup[]}
+ * @returns {DefaultTheme.SidebarItem[]}
*/
function getItemsByDate (path: string) {
// 侧边栏年份分组数组
- let yearGroups: DefaultTheme.SidebarGroup[] = []
-
+ let yearGroups: DefaultTheme.SidebarItem[] = [];
// 置顶数组
- let topArticleItems: DefaultTheme.SidebarItem[] = []
+ let topArticleItems: DefaultTheme.SidebarItem[] = [];
// 1.获取所有年份目录
sync(`docs/${path}/*`, {
onlyDirectories: true,
- objectMode: true
+ objectMode: true,
}).forEach(({ name }) => {
- let year = name
+ let year = name;
// 年份数组
- let articleItems: DefaultTheme.SidebarItem[] = []
+ let articleItems: DefaultTheme.SidebarItem[] = [];
// 2.获取所有月份目录
sync(`docs/${path}/${year}/*`, {
onlyDirectories: true,
- objectMode: true
+ objectMode: true,
}).forEach(({ name }) => {
let month = name
// 3.获取所有日期目录
sync(`docs/${path}/${year}/${month}/*`, {
onlyDirectories: true,
- objectMode: true
+ objectMode: true,
}).forEach(({ name }) => {
- let day = name
+ let day = name;
// 4.获取日期目录下的所有文章
sync(`docs/${path}/${year}/${month}/${day}/*`, {
onlyFiles: true,
- objectMode: true
+ objectMode: true,
}).forEach((article) => {
- const articleFile = matter.read(`${article.path}`)
- const { data } = articleFile
+ const articleFile = matter.read(`${article.path}`);
+ const { data } = articleFile;
if (data.isTop) {
// 向置顶分组前追加标题
topArticleItems.unshift({
text: data.title,
- link: `/${path}/${year}/${month}/${day}/${article.name.replace('.md', '')}`
- })
+ link: `/${path}/${year}/${month}/${day}/${article.name.replace('.md', '')}`,
+ });
}
// 向年份分组前追加标题
articleItems.unshift({
text: data.title,
- link: `/${path}/${year}/${month}/${day}/${article.name.replace('.md', '')}`
- })
+ link: `/${path}/${year}/${month}/${day}/${article.name.replace('.md', '')}`,
+ });
})
})
})
@@ -77,29 +76,29 @@ function getItemsByDate (path: string) {
// 添加年份分组
yearGroups.unshift({
text: `${year}年 (${articleItems.length}篇)`,
+ items: articleItems,
collapsed: true,
- items: articleItems
- })
+ });
})
if (topArticleItems.length > 0) {
// 添加置顶分组
yearGroups.unshift({
text: `📑 我的置顶 (${topArticleItems.length}篇)`,
+ items: topArticleItems,
collapsed: false,
- items: topArticleItems
- })
+ });
// 将最近年份分组展开
- yearGroups[1].collapsed = false
+ yearGroups[1].collapsed = false;
} else {
// 将最近年份分组展开
- yearGroups[0].collapsed = false
+ yearGroups[0].collapsed = false;
}
// 添加序号
- addOrderNumber(yearGroups)
- return yearGroups
+ addOrderNumber(yearGroups);
+ return yearGroups;
}
/**
@@ -108,54 +107,54 @@ function getItemsByDate (path: string) {
* courses/mybatis/01-MyBatis基础/01-xxx.md
*
* @param path 扫描基础路径
- * @returns {DefaultTheme.SidebarGroup[]}
+ * @returns {DefaultTheme.SidebarItem[]}
*/
function getItems (path: string) {
// 侧边栏分组数组
- let groups: DefaultTheme.SidebarGroup[] = []
+ let groups: DefaultTheme.SidebarItem[] = [];
// 侧边栏分组下标题数组
- let items: DefaultTheme.SidebarItem[] = []
- let total = 0
+ let items: DefaultTheme.SidebarItem[] = [];
+ let total = 0;
// 当分组内文章数量少于 2 篇或文章总数显示超过 20 篇时,自动折叠分组
- const groupCollapsedSize = 2
- const titleCollapsedSize = 20
+ const groupCollapsedSize = 2;
+ const titleCollapsedSize = 20;
// 1.获取所有分组目录
sync(`docs/${path}/*`, {
onlyDirectories: true,
- objectMode: true
+ objectMode: true,
}).forEach(({ name }) => {
- let groupName = name
+ let groupName = name;
// 2.获取分组下的所有文章
sync(`docs/${path}/${groupName}/*`, {
onlyFiles: true,
- objectMode: true
+ objectMode: true,
}).forEach((article) => {
- const articleFile = matter.read(`${article.path}`)
- const { data } = articleFile
+ const articleFile = matter.read(`${article.path}`);
+ const { data } = articleFile;
// 向前追加标题
items.push({
text: data.title,
- link: `/${path}/${groupName}/${article.name.replace('.md', '')}`
- })
- total ++
+ link: `/${path}/${groupName}/${article.name.replace('.md', '')}`,
+ });
+ total += 1;
})
// 3.向前追加到分组
// 当分组内文章数量少于 A 篇或文章总数显示超过 B 篇时,自动折叠分组
groups.push({
text: `${groupName.substring(groupName.indexOf('-') + 1)} (${items.length}篇)`,
+ items: items,
collapsed: items.length < groupCollapsedSize || total > titleCollapsedSize,
- items: items
})
// 4.清空侧边栏分组下标题数组
- items = []
+ items = [];
})
// 添加序号
- addOrderNumber(groups)
- return groups
+ addOrderNumber(groups);
+ return groups;
}
/**
@@ -164,10 +163,10 @@ function getItems (path: string) {
* @param groups 分组数据
*/
function addOrderNumber(groups) {
- for (var i = 0; i < groups.length; i++) {
- for (var j = 0; j < groups[i].items.length; j++) {
- var items = groups[i].items
- items[j].text = `[${j + 1}] ${items[j].text}`
+ for (let i = 0; i < groups.length; i++) {
+ for (let j = 0; j < groups[i].items.length; j++) {
+ const items = groups[i].items;
+ items[j].text = `[${j + 1}] ${items[j].text}`;
}
}
}
\ No newline at end of file
diff --git a/docs/.vitepress/config/theme.ts b/docs/.vitepress/config/theme.ts
index e4c3b0366..d11449dd2 100644
--- a/docs/.vitepress/config/theme.ts
+++ b/docs/.vitepress/config/theme.ts
@@ -1,15 +1,20 @@
-import DefaultTheme from 'vitepress/theme'
-import { nav } from './nav'
-import { sidebar } from './sidebar'
+import type { DefaultTheme } from 'vitepress';
+import { nav } from './nav';
+import { sidebar } from './sidebar';
export const themeConfig: DefaultTheme.Config = {
nav, // 导航栏配置
sidebar, // 侧边栏配置
logo: '/logo.png',
- outline: 'deep', // 右侧大纲标题层级
- outlineTitle: '目录', // 右侧大纲标题文本配置
+ outline: {
+ level: 'deep', // 右侧大纲标题层级
+ label: '目录', // 右侧大纲标题文本配置
+ },
outlineBadges: false, // 是否在大纲中显示 Badge 文本
+ darkModeSwitchLabel: '切换日光/暗黑模式',
+ sidebarMenuLabel: '文章',
+ returnToTopLabel: '返回顶部',
lastUpdatedText: '最后更新', // 最后更新时间文本配置, 需先配置lastUpdated为true
// 文档页脚文本配置
docFooter: {
@@ -60,10 +65,11 @@ export const themeConfig: DefaultTheme.Config = {
],
// 自定义扩展: 文章元数据配置
+ // @ts-ignore
articleMetadataConfig: {
author: '查尔斯', // 文章全局默认作者名称
authorLink: '/about/me', // 点击作者名时默认跳转的链接
- showViewCount: true // 是否显示文章阅读数, 需要在 docs/.vitepress/theme/api/config.js 及 interface.js 配置好相应 API 接口
+ showViewCount: true, // 是否显示文章阅读数, 需要在 docs/.vitepress/theme/api/config.js 及 interface.js 配置好相应 API 接口
},
// 自定义扩展: 文章版权配置
copyrightConfig: {
diff --git a/docs/.vitepress/theme/MyLayout.vue b/docs/.vitepress/theme/MyLayout.vue
index 025930476..ff92f1716 100644
--- a/docs/.vitepress/theme/MyLayout.vue
+++ b/docs/.vitepress/theme/MyLayout.vue
@@ -15,23 +15,21 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/docs/.vitepress/theme/api/config.js b/docs/.vitepress/theme/api/config.js
index bafdfe72f..891c89d87 100644
--- a/docs/.vitepress/theme/api/config.js
+++ b/docs/.vitepress/theme/api/config.js
@@ -1,24 +1,24 @@
-import axios from 'axios'
+import axios from 'axios';
const createBaseInstance = () => {
- const instance = axios.create({
- baseURL: 'https://api.charles7c.top/blog',
- timeout: 3000
- })
- instance.interceptors.request.use(handleRequest, handleError)
- instance.interceptors.response.use(handleResponse, handleError)
- return instance
+ const instance = axios.create({
+ baseURL: 'https://api.charles7c.top/blog',
+ timeout: 3000,
+ });
+ instance.interceptors.request.use(handleRequest, handleError);
+ instance.interceptors.response.use(handleResponse, handleError);
+ return instance;
}
-export const request = createBaseInstance()
+export const request = createBaseInstance();
function handleError(e) {
- throw e
+ throw e;
}
function handleRequest(request) {
- return request;
+ return request;
}
function handleResponse(response) {
- return response.data
+ return response.data;
}
\ No newline at end of file
diff --git a/docs/.vitepress/theme/api/index.js b/docs/.vitepress/theme/api/index.js
index ec92786e9..ddc68c649 100644
--- a/docs/.vitepress/theme/api/index.js
+++ b/docs/.vitepress/theme/api/index.js
@@ -1,3 +1,3 @@
-export * from './interface'
+export * from './interface';
-export { default } from './interface'
\ No newline at end of file
+export { default } from './interface';
\ No newline at end of file
diff --git a/docs/.vitepress/theme/api/interface.js b/docs/.vitepress/theme/api/interface.js
index f5900eac2..d732593ee 100644
--- a/docs/.vitepress/theme/api/interface.js
+++ b/docs/.vitepress/theme/api/interface.js
@@ -1,17 +1,17 @@
-import { request } from './config'
+import { request } from './config';
export const getArticleViewCount = (id, pageUrl, call) => {
- request.get(`/article/view/${id}?pageUrl=${pageUrl}`, {}).then(result => {
- call(process(result))
- })
-}
+ request.get(`/article/view/${id}?pageUrl=${pageUrl}`, {}).then(result => {
+ call(process(result));
+ });
+};
function process(result) {
- if (result.code === 200) {
- return result.data
- } else {
- console.log(result.msg)
- }
+ if (result.code === 200) {
+ return result.data;
+ } else {
+ console.log(result.msg);
+ }
}
export default { getArticleViewCount }
\ No newline at end of file
diff --git a/docs/.vitepress/theme/components/Archive.vue b/docs/.vitepress/theme/components/Archive.vue
index 3428276b2..041b90449 100644
--- a/docs/.vitepress/theme/components/Archive.vue
+++ b/docs/.vitepress/theme/components/Archive.vue
@@ -79,142 +79,97 @@
\ No newline at end of file
+
\ No newline at end of file
diff --git a/docs/.vitepress/theme/components/layout/Copyright.vue b/docs/.vitepress/theme/components/layout/Copyright.vue
index 33b61d126..2622be52c 100644
--- a/docs/.vitepress/theme/components/layout/Copyright.vue
+++ b/docs/.vitepress/theme/components/layout/Copyright.vue
@@ -43,18 +43,18 @@