Skip to content

Commit c967c44

Browse files
committed
[docs feat]vuepress 主题升级
1 parent e19fbf4 commit c967c44

File tree

8 files changed

+86
-131
lines changed

8 files changed

+86
-131
lines changed

docs/.vuepress/config.ts

+23-52
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,30 @@
1-
const { defineHopeConfig } = require("vuepress-theme-hope");
2-
import themeConfig from "./themeConfig";
1+
import { defineUserConfig } from "vuepress";
2+
import { themeConfig } from "./themeConfig";
3+
import { searchPlugin } from "@vuepress/plugin-search";
34

4-
module.exports = defineHopeConfig({
5-
port: "8080",
6-
title: "JavaGuide",
7-
description:
8-
"「Java学习指北+Java面试指南」一份涵盖大部分 Java 程序员所需要掌握的核心知识。准备 Java 面试,复习 Java 知识点,首选 JavaGuide! ",
9-
//指定 vuepress build 的输出目录
5+
export default defineUserConfig({
106
dest: "./dist",
11-
head: [
12-
// meta
13-
["meta", { name: "robots", content: "all" }],
14-
["meta", { name: "author", content: "Guide" }],
15-
[
16-
"meta",
17-
{
18-
"http-equiv": "Cache-Control",
19-
content: "no-cache, no-store, must-revalidate",
20-
},
21-
],
22-
["meta", { "http-equiv": "Pragma", content: "no-cache" }],
23-
["meta", { "http-equiv": "Expires", content: "0" }],
24-
[
25-
"meta",
26-
{
27-
name: "keywords",
28-
content:
29-
"Java基础, 多线程, JVM, 虚拟机, 数据库, MySQL, Spring, Redis, MyBatis, 系统设计, 分布式, RPC, 高可用, 高并发",
30-
},
31-
],
32-
["meta", { name: "apple-mobile-web-app-capable", content: "yes" }],
33-
// 添加百度统计
34-
[
35-
"script",
36-
{},
37-
`var _hmt = _hmt || [];
38-
(function() {
39-
var hm = document.createElement("script");
40-
hm.src = "https://hm.baidu.com/hm.js?5dd2e8c97962d57b7b8fea1737c01743";
41-
var s = document.getElementsByTagName("script")[0];
42-
s.parentNode.insertBefore(hm, s);
43-
})();`,
44-
],
45-
[
46-
"link",
47-
{
48-
rel: "stylesheet",
49-
href: "/iconfont/iconfont.css",
50-
},
51-
],
52-
],
7+
theme: themeConfig,
8+
shouldPrefetch: false,
539
locales: {
5410
"/": {
5511
lang: "zh-CN",
56-
},
12+
}
5713
},
58-
themeConfig,
14+
plugins: [
15+
searchPlugin({
16+
// https://v2.vuepress.vuejs.org/zh/reference/plugin/search.html
17+
// 排除首页
18+
isSearchable: (page) => page.path !== "/",
19+
maxSuggestions: 10,
20+
hotKeys: ["s", "/"],
21+
// 用于在页面的搜索索引中添加额外字段
22+
getExtraFields: () => [],
23+
locales: {
24+
"/": {
25+
placeholder: "搜索",
26+
},
27+
},
28+
}),
29+
],
5930
});

docs/.vuepress/navbar.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { defineNavbarConfig } from "vuepress-theme-hope";
1+
import { navbar } from "vuepress-theme-hope";
22

3-
export const navbarConfig = defineNavbarConfig([
3+
export const navbarConfig = navbar([
44
{ text: "面试指南", icon: "java", link: "/home.md" },
55
{ text: "开源项目", icon: "github", link: "/open-source-project/" },
66
{ text: "技术书籍", icon: "book", link: "/books/" },

0 commit comments

Comments
 (0)