|
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"; |
3 | 4 |
|
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({ |
10 | 6 | 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, |
53 | 9 | locales: {
|
54 | 10 | "/": {
|
55 | 11 | lang: "zh-CN",
|
56 |
| - }, |
| 12 | + } |
57 | 13 | },
|
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 | + ], |
59 | 30 | });
|
0 commit comments