Skip to content

Commit

Permalink
[docs feat]vuepress 主题升级
Browse files Browse the repository at this point in the history
  • Loading branch information
Snailclimb committed Nov 15, 2022
1 parent e19fbf4 commit c967c44
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 131 deletions.
75 changes: 23 additions & 52 deletions docs/.vuepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,59 +1,30 @@
const { defineHopeConfig } = require("vuepress-theme-hope");
import themeConfig from "./themeConfig";
import { defineUserConfig } from "vuepress";
import { themeConfig } from "./themeConfig";
import { searchPlugin } from "@vuepress/plugin-search";

module.exports = defineHopeConfig({
port: "8080",
title: "JavaGuide",
description:
"「Java学习指北+Java面试指南」一份涵盖大部分 Java 程序员所需要掌握的核心知识。准备 Java 面试,复习 Java 知识点,首选 JavaGuide! ",
//指定 vuepress build 的输出目录
export default defineUserConfig({
dest: "./dist",
head: [
// meta
["meta", { name: "robots", content: "all" }],
["meta", { name: "author", content: "Guide" }],
[
"meta",
{
"http-equiv": "Cache-Control",
content: "no-cache, no-store, must-revalidate",
},
],
["meta", { "http-equiv": "Pragma", content: "no-cache" }],
["meta", { "http-equiv": "Expires", content: "0" }],
[
"meta",
{
name: "keywords",
content:
"Java基础, 多线程, JVM, 虚拟机, 数据库, MySQL, Spring, Redis, MyBatis, 系统设计, 分布式, RPC, 高可用, 高并发",
},
],
["meta", { name: "apple-mobile-web-app-capable", content: "yes" }],
// 添加百度统计
[
"script",
{},
`var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?5dd2e8c97962d57b7b8fea1737c01743";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();`,
],
[
"link",
{
rel: "stylesheet",
href: "/iconfont/iconfont.css",
},
],
],
theme: themeConfig,
shouldPrefetch: false,
locales: {
"/": {
lang: "zh-CN",
},
}
},
themeConfig,
plugins: [
searchPlugin({
// https://v2.vuepress.vuejs.org/zh/reference/plugin/search.html
// 排除首页
isSearchable: (page) => page.path !== "/",
maxSuggestions: 10,
hotKeys: ["s", "/"],
// 用于在页面的搜索索引中添加额外字段
getExtraFields: () => [],
locales: {
"/": {
placeholder: "搜索",
},
},
}),
],
});
4 changes: 2 additions & 2 deletions docs/.vuepress/navbar.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defineNavbarConfig } from "vuepress-theme-hope";
import { navbar } from "vuepress-theme-hope";

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

0 comments on commit c967c44

Please sign in to comment.