1
- import { defineConfig } from 'vitepress'
2
- import { groupIconMdPlugin , groupIconVitePlugin } from 'vitepress-plugin-group-icons' // 实现自定义图标的插件
1
+ import { defineConfig } from "vitepress" ;
2
+ import {
3
+ groupIconMdPlugin ,
4
+ groupIconVitePlugin ,
5
+ } from "vitepress-plugin-group-icons" ; // 实现自定义图标的插件
3
6
4
- import nav from ' ./nav.mts' ; // 导航栏配置
5
- import sidebar from ' ./sidebar.mts' ; // 侧边栏配置
7
+ import nav from " ./nav.mts" ; // 导航栏配置
8
+ import sidebar from " ./sidebar.mts" ; // 侧边栏配置
6
9
7
- import { RSSOptions , RssPlugin } from ' vitepress-plugin-rss' // 实现自动为 VitePress 网站添加 RSS 订阅的插件
8
- const baseUrl = ' https://vite.xingji.fun'
10
+ import { RSSOptions , RssPlugin } from " vitepress-plugin-rss" ; // 实现自动为 VitePress 网站添加 RSS 订阅的插件
11
+ const baseUrl = " https://vite.xingji.fun" ;
9
12
const RSS : RSSOptions = {
10
- title : ' XINGJI' ,
13
+ title : " XINGJI" ,
11
14
baseUrl,
12
- copyright : ' Copyright (c) 2024-present, XINGJI ' ,
13
- }
15
+ copyright : " Copyright (c) 2024-present, XINGJI " ,
16
+ } ;
14
17
15
- import { GitChangelog , GitChangelogMarkdownSection , } from '@nolebase/vitepress-plugin-git-changelog/vite' // 实现自动生成 CHANGELOG 的插件
18
+ import {
19
+ GitChangelog ,
20
+ GitChangelogMarkdownSection ,
21
+ } from "@nolebase/vitepress-plugin-git-changelog/vite" ; // 实现自动生成 CHANGELOG 的插件
16
22
17
23
// https://vitepress.dev/reference/site-config
18
24
export default defineConfig ( {
19
- lang : ' zh-CN' , //语言,可选 en-US
25
+ lang : " zh-CN" , //语言,可选 en-US
20
26
title : "XINGJI" , //站点名
21
27
description : "我的vitpress文档教程" , //站点描述
22
- appearance : ' dark' ,
28
+ appearance : " dark" ,
23
29
lastUpdated : true , //首次配置不会立即生效,需git提交后爬取时间戳
24
30
head : [
25
- [ ' link' , { rel : ' icon' , href : ' /my-logo.png' } ] , //fav图标
31
+ [ " link" , { rel : " icon" , href : " /my-logo.png" } ] , //fav图标
26
32
] ,
27
33
// 站点地图
28
34
sitemap : {
29
- hostname : ' https://vite.xingji.fun' ,
35
+ hostname : " https://vite.xingji.fun" ,
30
36
} ,
31
37
32
38
//多语言
33
39
locales : {
34
40
root : {
35
- label : ' 简体中文' ,
36
- lang : ' Zh_CN' ,
41
+ label : " 简体中文" ,
42
+ lang : " Zh_CN" ,
37
43
} ,
38
44
en : {
39
- label : ' English' ,
40
- lang : 'en' ,
41
- link : ' /en/' ,
45
+ label : " English" ,
46
+ lang : "en" ,
47
+ link : " /en/" ,
42
48
} ,
43
49
} ,
44
50
@@ -50,93 +56,101 @@ export default defineConfig({
50
56
// 组件插入h1标题下
51
57
config : ( md ) => {
52
58
md . renderer . rules . heading_close = ( tokens , idx , options , env , slf ) => {
53
- let htmlResult = slf . renderToken ( tokens , idx , options ) ;
54
- if ( tokens [ idx ] . tag === 'h1' ) htmlResult += `<ArticleMetadata />` ;
59
+ let htmlResult = slf . renderToken ( tokens , idx , options ) ;
60
+ if ( tokens [ idx ] . tag === "h1" ) htmlResult += `<ArticleMetadata />` ;
55
61
return htmlResult ;
56
- }
57
- md . use ( groupIconMdPlugin ) //代码组图标
58
- }
62
+ } ;
63
+ md . use ( groupIconMdPlugin ) ; //代码组图标
64
+ } ,
59
65
} ,
60
66
// 实现自动为 VitePress 网站添加 RSS 订阅的插件
61
67
vite : {
62
68
// ↓↓↓↓↓
69
+ resolve : {
70
+ alias : {
71
+ "./VPContent.vue" : "./theme/components/VPContent.vue" ,
72
+ } ,
73
+ } ,
74
+ // 确保环境变量能够正常工作
75
+ envPrefix : "VITE_" ,
63
76
plugins : [
64
77
RssPlugin ( RSS ) ,
65
78
groupIconVitePlugin ( ) , //代码组图标
66
79
GitChangelog ( {
67
80
// 填写在此处填写您的仓库链接
68
- repoURL : ( ) => ' https://github.com/XingJi-love/Blog-VitePress' ,
81
+ repoURL : ( ) => " https://github.com/XingJi-love/Blog-VitePress" ,
69
82
} ) ,
70
83
GitChangelogMarkdownSection ( ) ,
71
84
] ,
72
85
optimizeDeps : {
73
86
exclude : [
74
- ' @nolebase/vitepress-plugin-enhanced-readabilities/client' ,
75
- ' vitepress' ,
76
- ' @nolebase/ui' ,
87
+ " @nolebase/vitepress-plugin-enhanced-readabilities/client" ,
88
+ " vitepress" ,
89
+ " @nolebase/ui" ,
77
90
] ,
78
91
} ,
79
92
ssr : {
80
93
noExternal : [
81
- ' @nolebase/vitepress-plugin-enhanced-readabilities' ,
82
- ' @nolebase/vitepress-plugin-highlight-targeted-heading' ,
83
- ' @nolebase/ui'
94
+ " @nolebase/vitepress-plugin-enhanced-readabilities" ,
95
+ " @nolebase/vitepress-plugin-highlight-targeted-heading" ,
96
+ " @nolebase/ui" ,
84
97
] ,
85
98
} ,
86
99
} ,
87
100
88
101
themeConfig : {
89
102
//左上角logo
90
- logo : ' /my-logo.png' ,
91
- darkModeSwitchLabel : ' 深浅模式' , //手机端深浅模式文字修改
92
- sidebarMenuLabel : '目录' , //侧边栏文字更改(移动端)
93
- returnToTopLabel : ' 返回顶部' , //返回顶部文字修改
94
- outline : {
95
- level : [ 2 , 4 ] , // 显示2-4级标题
103
+ logo : " /my-logo.png" ,
104
+ darkModeSwitchLabel : " 深浅模式" , //手机端深浅模式文字修改
105
+ sidebarMenuLabel : "目录" , //侧边栏文字更改(移动端)
106
+ returnToTopLabel : " 返回顶部" , //返回顶部文字修改
107
+ outline : {
108
+ level : [ 2 , 4 ] , // 显示2-4级标题
96
109
// level: 'deep', // 显示2-6级标题
97
- label : ' 页面导航' // 文字显示
110
+ label : " 页面导航" , // 文字显示
98
111
} ,
99
112
//上次更新时间
100
113
lastUpdated : {
101
- text : ' 上次更新时间' ,
114
+ text : " 上次更新时间" ,
102
115
formatOptions : {
103
- dateStyle : ' short' , // 可选值full、long、medium、short
104
- timeStyle : ' medium' // 可选值full、long、medium、short
116
+ dateStyle : " short" , // 可选值full、long、medium、short
117
+ timeStyle : " medium" , // 可选值full、long、medium、short
105
118
} ,
106
119
} ,
107
120
//自定义上下页名
108
- docFooter : {
109
- prev : ' 上一页' ,
110
- next : ' 下一页' ,
121
+ docFooter : {
122
+ prev : " 上一页" ,
123
+ next : " 下一页" ,
111
124
} ,
112
125
// https://vitepress.dev/reference/default-theme-config
113
126
//导航栏
114
127
nav : nav , // 导航栏配置
115
128
sidebar : sidebar , // 侧边栏配置
116
129
117
130
//编辑本页
118
- editLink : {
119
- pattern : ' https://github.com/XingJi-love/Blog-VitePress' , // 改成自己的仓库
120
- text : ' 在GitHub编辑本页'
131
+ editLink : {
132
+ pattern : " https://github.com/XingJi-love/Blog-VitePress" , // 改成自己的仓库
133
+ text : " 在GitHub编辑本页" ,
121
134
} ,
122
135
123
136
socialLinks : [
124
- { icon : ' github' , link : ' https://github.com/XingJi-love' } ,
137
+ { icon : " github" , link : " https://github.com/XingJi-love" } ,
125
138
{
126
- icon : {
127
- svg : '<svg t="1728183147842" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2076" data-darkreader-inline-fill="" width="200" height="200"><path d="M512 0c282.784 0 512 229.216 512 512s-229.216 512-512 512S0 794.784 0 512 229.216 0 512 0z m189.952 752l11.2-108.224c-31.904 9.536-100.928 16.128-147.712 16.128-134.464 0-205.728-47.296-195.328-146.304 11.584-110.688 113.152-145.696 232.64-145.696 54.784 0 122.432 8.8 151.296 18.336L768 272.704C724.544 262.24 678.272 256 599.584 256c-203.2 0-388.704 94.88-406.4 263.488C178.336 660.96 303.584 768 535.616 768c80.672 0 138.464-6.432 166.336-16z" fill="#1296db" p-id="2077" data-darkreader-inline-fill="" style="--darkreader-inline-fill:#0e78af;"></path></svg>' ,
128
- } ,
129
- link : ' https://blog.csdn.net/AcsdnHZB?spm=1011.2648.3001.5343' ,
139
+ icon : {
140
+ svg : '<svg t="1728183147842" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2076" data-darkreader-inline-fill="" width="200" height="200"><path d="M512 0c282.784 0 512 229.216 512 512s-229.216 512-512 512S0 794.784 0 512 229.216 0 512 0z m189.952 752l11.2-108.224c-31.904 9.536-100.928 16.128-147.712 16.128-134.464 0-205.728-47.296-195.328-146.304 11.584-110.688 113.152-145.696 232.64-145.696 54.784 0 122.432 8.8 151.296 18.336L768 272.704C724.544 262.24 678.272 256 599.584 256c-203.2 0-388.704 94.88-406.4 263.488C178.336 660.96 303.584 768 535.616 768c80.672 0 138.464-6.432 166.336-16z" fill="#1296db" p-id="2077" data-darkreader-inline-fill="" style="--darkreader-inline-fill:#0e78af;"></path></svg>' ,
141
+ } ,
142
+ link : " https://blog.csdn.net/AcsdnHZB?spm=1011.2648.3001.5343" ,
130
143
} ,
131
144
{
132
- icon : {
133
- svg : '<svg t="1728183344877" class="icon" viewBox="0 0 1129 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1673" data-darkreader-inline-fill="" width="200" height="200"><path d="M234.909 9.656a80.468 80.468 0 0 1 68.398 0 167.374 167.374 0 0 1 41.843 30.578l160.937 140.82h115.07l160.936-140.82a168.983 168.983 0 0 1 41.843-30.578A80.468 80.468 0 0 1 930.96 76.445a80.468 80.468 0 0 1-17.703 53.914 449.818 449.818 0 0 1-35.406 32.187 232.553 232.553 0 0 1-22.531 18.508h100.585a170.593 170.593 0 0 1 118.289 53.109 171.397 171.397 0 0 1 53.914 118.288v462.693a325.897 325.897 0 0 1-4.024 70.007 178.64 178.64 0 0 1-80.468 112.656 173.007 173.007 0 0 1-92.539 25.75h-738.7a341.186 341.186 0 0 1-72.421-4.024A177.835 177.835 0 0 1 28.91 939.065a172.202 172.202 0 0 1-27.36-92.539V388.662a360.498 360.498 0 0 1 0-66.789A177.03 177.03 0 0 1 162.487 178.64h105.414c-16.899-12.07-31.383-26.555-46.672-39.43a80.468 80.468 0 0 1-25.75-65.984 80.468 80.468 0 0 1 39.43-63.57M216.4 321.873a80.468 80.468 0 0 0-63.57 57.937 108.632 108.632 0 0 0 0 30.578v380.615a80.468 80.468 0 0 0 55.523 80.469 106.218 106.218 0 0 0 34.601 5.632h654.208a80.468 80.468 0 0 0 76.444-47.476 112.656 112.656 0 0 0 8.047-53.109v-354.06a135.187 135.187 0 0 0 0-38.625 80.468 80.468 0 0 0-52.304-54.719 129.554 129.554 0 0 0-49.89-7.242H254.22a268.764 268.764 0 0 0-37.82 0z m0 0" fill="#20B0E3" p-id="1674" data-darkreader-inline-fill="" style="--darkreader-inline-fill:#168ab3;"></path><path d="M348.369 447.404a80.468 80.468 0 0 1 55.523 18.507 80.468 80.468 0 0 1 28.164 59.547v80.468a80.468 80.468 0 0 1-16.094 51.5 80.468 80.468 0 0 1-131.968-9.656 104.609 104.609 0 0 1-10.46-54.719v-80.468a80.468 80.468 0 0 1 70.007-67.593z m416.02 0a80.468 80.468 0 0 1 86.102 75.64v80.468a94.148 94.148 0 0 1-12.07 53.11 80.468 80.468 0 0 1-132.773 0 95.757 95.757 0 0 1-12.875-57.133V519.02a80.468 80.468 0 0 1 70.007-70.812z m0 0" fill="#20B0E3" p-id="1675" data-darkreader-inline-fill="" style="--darkreader-inline-fill:#168ab3;"></path></svg>' ,
134
- } ,
135
- link : ' https://space.bilibili.com/1289480756?spm_id_from=333.1007.0.0' ,
136
- } ,
145
+ icon : {
146
+ svg : '<svg t="1728183344877" class="icon" viewBox="0 0 1129 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1673" data-darkreader-inline-fill="" width="200" height="200"><path d="M234.909 9.656a80.468 80.468 0 0 1 68.398 0 167.374 167.374 0 0 1 41.843 30.578l160.937 140.82h115.07l160.936-140.82a168.983 168.983 0 0 1 41.843-30.578A80.468 80.468 0 0 1 930.96 76.445a80.468 80.468 0 0 1-17.703 53.914 449.818 449.818 0 0 1-35.406 32.187 232.553 232.553 0 0 1-22.531 18.508h100.585a170.593 170.593 0 0 1 118.289 53.109 171.397 171.397 0 0 1 53.914 118.288v462.693a325.897 325.897 0 0 1-4.024 70.007 178.64 178.64 0 0 1-80.468 112.656 173.007 173.007 0 0 1-92.539 25.75h-738.7a341.186 341.186 0 0 1-72.421-4.024A177.835 177.835 0 0 1 28.91 939.065a172.202 172.202 0 0 1-27.36-92.539V388.662a360.498 360.498 0 0 1 0-66.789A177.03 177.03 0 0 1 162.487 178.64h105.414c-16.899-12.07-31.383-26.555-46.672-39.43a80.468 80.468 0 0 1-25.75-65.984 80.468 80.468 0 0 1 39.43-63.57M216.4 321.873a80.468 80.468 0 0 0-63.57 57.937 108.632 108.632 0 0 0 0 30.578v380.615a80.468 80.468 0 0 0 55.523 80.469 106.218 106.218 0 0 0 34.601 5.632h654.208a80.468 80.468 0 0 0 76.444-47.476 112.656 112.656 0 0 0 8.047-53.109v-354.06a135.187 135.187 0 0 0 0-38.625 80.468 80.468 0 0 0-52.304-54.719 129.554 129.554 0 0 0-49.89-7.242H254.22a268.764 268.764 0 0 0-37.82 0z m0 0" fill="#20B0E3" p-id="1674" data-darkreader-inline-fill="" style="--darkreader-inline-fill:#168ab3;"></path><path d="M348.369 447.404a80.468 80.468 0 0 1 55.523 18.507 80.468 80.468 0 0 1 28.164 59.547v80.468a80.468 80.468 0 0 1-16.094 51.5 80.468 80.468 0 0 1-131.968-9.656 104.609 104.609 0 0 1-10.46-54.719v-80.468a80.468 80.468 0 0 1 70.007-67.593z m416.02 0a80.468 80.468 0 0 1 86.102 75.64v80.468a94.148 94.148 0 0 1-12.07 53.11 80.468 80.468 0 0 1-132.773 0 95.757 95.757 0 0 1-12.875-57.133V519.02a80.468 80.468 0 0 1 70.007-70.812z m0 0" fill="#20B0E3" p-id="1675" data-darkreader-inline-fill="" style="--darkreader-inline-fill:#168ab3;"></path></svg>' ,
147
+ } ,
148
+ link : " https://space.bilibili.com/1289480756?spm_id_from=333.1007.0.0" ,
149
+ } ,
137
150
] ,
138
151
footer : {
139
- copyright : 'Copyright © 2024 XINGJI <a href="https://icp.gov.moe/?keyword=20250322" target="_blank">萌ICP备20250322号</a>'
152
+ copyright :
153
+ 'Copyright © 2024 XINGJI <a href="https://icp.gov.moe/?keyword=20250322" target="_blank">萌ICP备20250322号</a>' ,
140
154
} ,
141
155
// 设置搜索框的样式
142
156
search : {
@@ -159,4 +173,4 @@ export default defineConfig({
159
173
} ,
160
174
} ,
161
175
} ,
162
- } )
176
+ } ) ;
0 commit comments