-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvitepress.config.js
222 lines (215 loc) · 6.12 KB
/
vitepress.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
// https://vitepress.dev/reference/site-config
// https://vitepress.dev/reference/default-theme-config
import { generateSidebar } from 'vitepress-sidebar'
import dayjs from 'dayjs'
import { appName } from './src/configs/index.js'
const sidebar
= generateSidebar({
documentRootPath: 'src/notes/',
useTitleFromFileHeading: true,
collapsed: false,
includeRootIndexFile: false,
capitalizeFirst: true,
}) || []
// console.log('sidebar', JSON.stringify(sidebar))
const memo = (() => {
// @ts-expect-error
const items = sidebar.find(item => item.text === 'Memo')?.items || []
const value = items.filter(item => item.text !== 'Index.md')
return value
})()
// console.log('memo', JSON.stringify(memo))
function useImgTag(src) {
return `<img src="${src}" style="width: 20px; height: 20px;" class="hover:opacity-100 opacity-70 duration-500" />`
}
export default {
title: appName,
lang: 'zh-CN',
head: [
[
'link',
{
rel: 'icon',
href: '/images/avatar.jpg',
},
],
// 百度统计工具
[
'script',
{
src: 'https://hm.baidu.com/hm.js?8731b7a102ed9bd8d70286c74cedea79',
},
],
// 不蒜子统计工具
[
'script',
{
src: 'https://busuanzi.9420.ltd/js',
},
],
],
srcDir: './src/notes',
outDir: './dist',
vue: {
template: {
compilerOptions: {
isCustomElement: tag => tag === 'lottie-player',
},
},
},
sitemap: {
hostname: 'https://viarotel.eu.org',
},
themeConfig: {
logo: { src: '/images/avatar.gif', alt: appName },
search: {
provider: 'algolia',
options: {
appId: 'XY26T0U1UR',
apiKey: 'd92446a9ce99be7089c291a2dae47778',
indexName: 'viarotelio',
locales: {
root: {
placeholder: '请输入关键词',
translations: {
button: {
buttonText: '搜索',
buttonAriaLabel: '搜索',
},
modal: {
searchBox: {
resetButtonTitle: '清除查询条件',
resetButtonAriaLabel: '清除查询条件',
cancelButtonText: '取消',
cancelButtonAriaLabel: '取消',
},
startScreen: {
recentSearchesTitle: '搜索历史',
noRecentSearchesText: '没有搜索历史',
saveRecentSearchButtonTitle: '保存至搜索历史',
removeRecentSearchButtonTitle: '从搜索历史中移除',
favoriteSearchesTitle: '收藏',
removeFavoriteSearchButtonTitle: '从收藏中移除',
},
errorScreen: {
titleText: '无法获取结果',
helpText: '你可能需要检查你的网络连接',
},
footer: {
selectText: '选择',
navigateText: '切换',
closeText: '关闭',
searchByText: '搜索提供者',
},
noResultsScreen: {
noResultsText: '无法找到相关结果',
suggestedQueryText: '你可以尝试查询',
reportMissingResultsText: '你认为该查询应该有结果?',
reportMissingResultsLinkText: '点击反馈',
},
},
},
},
en: {
placeholder: 'Please enter a keyword',
},
},
},
},
socialLinks: [
{
icon: 'github',
link: 'https://github.com/viarotel/viarotel.github.io',
},
{
icon: {
svg: useImgTag('https://gitee.com/favicon.ico'),
},
link: 'https://gitee.com/viarotel',
},
{
icon: {
svg: useImgTag(
'https://lf3-cdn-tos.bytescm.com/obj/static/xitu_juejin_web//static/favicons/favicon-32x32.png',
),
},
link: 'https://juejin.cn/user/1275089219751944',
},
],
footer: {
message: `
Views <span id="busuanzi_site_pv"></span>
,
Visitors <span id="busuanzi_site_uv"></span>
<br />
Released under the MIT License.
`,
copyright: `Copyright © 2023-${dayjs().format('YYYY')} viarotel`,
},
},
locales: {
root: {
label: '简体中文',
titleTemplate: `这里是 ${appName}`,
description: `这里是 ${appName}`,
themeConfig: {
nav: [
{ text: '主页', link: '/' },
{ text: '备忘', link: '/memo/' },
{ text: '书签', link: '/bookmarks' },
{ text: '关于我', link: '/about' },
],
sidebar: [
{
text: '备忘录',
items: [{ text: '前言', link: '/memo/' }, ...memo],
},
{
text: '关于我',
items: [
{ text: '简介', link: '/about' },
{ text: '联系', link: '/contact' },
{ text: '书签', link: '/bookmarks' },
],
},
],
returnToTopLabel: '返回顶部',
outlineTitle: '当前页',
lastUpdatedText: '最后更新时间',
docFooter: {
prev: '上一页',
next: '下一页',
},
},
},
en: {
label: 'English',
lang: 'en',
titleTemplate: 'This is viarotel',
description: 'This is viarotel',
themeConfig: {
nav: [
{ text: 'Home', link: '/en/' },
{ text: 'Memo', link: '/en/memo/' },
{ text: 'Bookmarks', link: '/bookmarks' },
{ text: 'About me', link: '/en/about' },
],
sidebar: [
{
text: 'Memo',
items: [{ text: 'Preface', link: '/en/memo/' }, ...memo],
},
{
text: 'About me',
items: [
{ text: 'About', link: '/en/about' },
{ text: 'Contact', link: '/en/contact' },
{ text: 'Bookmarks', link: '/bookmarks' },
],
},
],
},
},
},
lastUpdated: true,
}