主题配置

Mr.Hope ... 2020-10-17 Config
  • ThemeConfig
  • Config
大约 1 分钟

提示

你可以查看 本文档的配置 (opens new window) 作为案例,你也可以直接查看源代码中的 types 文件 (opens new window)

另外我们还提供了 themeConfig Helper 函数,你可以引入它来提供自动补全和校验:

// .vuepress/themeConfig.js
const { themeConfig } = require("vuepress-theme-hope");

module.exports = themeConfig(/* Your themeConfig here */);
1
2
3
4

.vuepress/config.js 中的 themeConfig 字段(主题字段)新增以下配置:

# 基本选项

警告

这些选项很重要,需要你正确配置。

# author

  • 类型: string
  • 必填: 否

文章显示的默认作者

NavBarItem 新增

  • icon 字段来支持图标显示。
  • prefix 字段来自动添加分组前缀

具体配置,请见 布局 → 导航栏

SideBarItem 新增

  • icon 字段来支持图标显示。
  • prefix 字段来自动添加分组前缀

具体配置,请见 布局 → 侧边栏

# locales

  • 类型: Record<string, HopeLangI18nConfigItem>

主题的多语言配置,主要需要配置各语言的 navsidebar

# hostname

  • 类型: string
  • 必填: 是

当前网站部署到的域名。

# 更多配置