Skip to content

Commit 59d6c21

Browse files
author
Chu Fan
committed
feat: 支持中文配置,优化访问链接
1 parent 62a399d commit 59d6c21

File tree

5 files changed

+99
-12
lines changed

5 files changed

+99
-12
lines changed

Readme.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@
2020

2121
### 在线浏览
2222

23-
<https://142vip.cn/JavaScriptCollection>
23+
- 尝鲜版:<https://142vip.github.io/JavaScriptCollection>
24+
- 稳定版:<https://142vip.cn/JavaScriptCollection>
25+
2426

2527
网站无法访问时,建议通过科学上网访问备用网络
2628

27-
- Github: <https://142vip.github.io/JavaScriptCollection>
2829
- Netlify: <https://js-collection.netlify.app>
2930
- Vercel: <https://js-collection.vercel.app>
3031

docs/.vuepress/config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ export default defineUserConfig({
3838
level: [2, 3, 4]
3939
}
4040
},
41-
4241
// 主题配置
4342
...themeConfig,
4443
// 插件配置
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import {ThemeLocaleData} from "vuepress-theme-hope";
2+
3+
/**
4+
* 支持中文
5+
* 参考:https://theme-hope.vuejs.press/zh/config/i18n.html
6+
*/
7+
const localCN: ThemeLocaleData = {
8+
lang: "zh-CN",
9+
navbarLocales: {
10+
langName: "简体中文",
11+
selectLangAriaLabel: "选择语言",
12+
},
13+
metaLocales: {
14+
author: "作者",
15+
date: "写作日期",
16+
origin: "原创",
17+
views: "访问量",
18+
category: "分类",
19+
tag: "标签",
20+
readingTime: "阅读时间",
21+
words: "字数",
22+
toc: "标题大纲",
23+
prev: "上一页",
24+
next: "下一页",
25+
lastUpdated: "上次编辑于",
26+
contributors: "贡献者",
27+
editLink: "编辑此页",
28+
print: "打印",
29+
},
30+
31+
blogLocales: {
32+
article: "文章",
33+
articleList: "文章列表",
34+
category: "分类",
35+
tag: "标签",
36+
timeline: "时间轴",
37+
timelineTitle: "昨日不在",
38+
all: "全部",
39+
intro: "个人介绍",
40+
star: "收藏",
41+
},
42+
43+
paginationLocales: {
44+
prev: "上一页",
45+
next: "下一页",
46+
navigate: "跳转到",
47+
action: "前往",
48+
errorText: "请输入 1 到 $page 之前的页码!",
49+
},
50+
51+
outlookLocales: {
52+
themeColor: "主题色",
53+
darkmode: "外观",
54+
fullscreen: "全屏",
55+
},
56+
57+
encryptLocales: {
58+
iconLabel: "文章已加密",
59+
placeholder: "输入密码",
60+
remember: "记住密码",
61+
errorHint: "请输入正确的密码",
62+
},
63+
routeLocales: {
64+
skipToContent: "跳至主要內容",
65+
notFoundTitle: "访问的页面不存在,嘤嘤嘤",
66+
notFoundMsg: [
67+
"这里什么也没有",
68+
"我们是怎么来到这儿的?",
69+
"这 是 四 零 四 !",
70+
"看起来你访问了一个失效的链接",
71+
],
72+
back: "返回",
73+
home: "首页",
74+
openInNewWindow: "新窗口打开",
75+
},
76+
}
77+
78+
/**
79+
* 自定义语言,支持文案
80+
*/
81+
export const langConfig = {
82+
"/": localCN
83+
}

docs/.vuepress/config/theme.config.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ import navbar from "./navbar";
22
import sidebar from "./sidebar";
33
import {FOOTER_HTML_INFO} from "./constant.config";
44
import {hopeTheme} from "vuepress-theme-hope";
5+
import {langConfig} from "./lang.config";
56

67
/**
78
* 主题相关配置
89
* 参考主题:https://theme-hope.vuejs.press/zh/config/intro.html#%E9%85%8D%E7%BD%AE%E6%A6%82%E5%BF%B5
910
*/
1011
export default {
1112
theme: hopeTheme({
13+
locales: langConfig,
1214
navbarIcon: false,
1315
darkmode: "toggle",
1416
// 支持全屏
@@ -17,7 +19,7 @@ export default {
1719
// pure: true,
1820
hostname: 'https://408.142vip.cn',
1921
author: {
20-
name: 'Chu·Fan',
22+
name: '储凡',
2123
email: 'fairy_408@2925.com',
2224
url: 'https://www.142vip.cn'
2325
},
@@ -31,13 +33,15 @@ export default {
3133
end: ["Language", "Search", "Repo", "Outlook",]
3234
},
3335
sidebar: sidebar,
34-
// sidebar: "heading",
3536

3637
pageInfo: ["Author", "Original", "Date", "Category", "Tag", "ReadingTime"],
3738
// 主题布局选项
38-
docsRepo: "https://github.com/142vip/JavaScriptCollection.git",
39-
repo: "https://github.com/142vip/JavaScriptCollection",
39+
docsRepo: "https://github.com/142vip/JavaScriptCollection",
40+
docsDir: "docs",
41+
docsBranch: "master",
42+
repo: "https://github.com/142vip/JavaScriptCollection.git",
4043
// logoDark: "/assets/408_logo.png",
44+
// logo: "/assets/408_logo.png",
4145

4246
// 博客配置
4347
blog: {

docs/readme.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,17 @@ yarn run dev
108108
查看项目启动日志并访问:[http://127.0.0.1:5000](http://localhost:5000),开启学习之旅吧~
109109

110110

111-
## 在线浏览
111+
### 在线浏览
112112

113-
<https://142vip.cn/JavaScriptCollection>
113+
- 尝鲜版:<https://142vip.github.io/JavaScriptCollection>
114+
- 稳定版:<https://142vip.cn/JavaScriptCollection>
114115

115-
网站无法访问时,建议通过科学`上网访问`备用网络
116116

117-
- Github: <https://142vip.github.io/JavaScriptCollection>
117+
网站无法访问时,建议通过科学上网访问备用网络
118+
118119
- Netlify: <https://js-collection.netlify.app>
119120
- Vercel: <https://js-collection.vercel.app>
120121

121-
122122
## 提交记录
123123

124124

0 commit comments

Comments
 (0)