# 默认主题配置(default theme config)

提示

此页面上列出的所有选项仅适用于默认主题。如果你使用的是自定义主题,则选项可能会有所不同。

# 主页(Homepage)

默认主题提供了一个主页布局(用于该网站的主页)。要使用它,需要在你的根目录 README.md 的 YAML front matter 中指定 home:true 加上一些其他元数据。这是本网站使用的实际数据:---

home: true

heroImage: /hero.png

actionText: Get Started →

actionLink: /guide/

features:

- title: Simplicity First

details: Minimal setup with markdown-centered project structure helps you focus on writing.

- title: Vue-Powered

details: Enjoy the dev experience of Vue + webpack, use Vue components in markdown, and develop custom themes with Vue.

- title: Performant

details: VuePress generates pre-rendered static HTML for each page, and runs as an SPA once a page is loaded.

footer: MIT Licensed | Copyright © 2018-present Evan You

---

YAML front matter 的内容之后的任意其他内容,将被解析为正常 markdown,并在特性部分之后渲染。

If you want to use a completely custom homepage layout, you can also use a Custom Layout.

# 导航链接(navbar links)

你可以通过 themeConfig.nav 将链接添加到导航栏中:// .vuepress/config.js

module.exports = {

themeConfig: {

nav: [

{ text: 'Home', link: '/' },

{ text: 'Guide', link: '/guide/' },

{ text: 'External', link: 'https://google.com' },

]

}

}

These links can also be dropdown menus if you provide an array of items instead of a link:module.exports = {

themeConfig: {

nav: [

{

text: 'Languages',

items: [

{ text: 'Chinese', link: '/language/chinese' },

{ text: 'Japanese', link: '/language/japanese' }

]

}

]

}

}

In addition, you can have sub groups inside a dropdown by having nested items:module.exports = {

themeConfig: {

nav: [

{

text: 'Languages',

items: [

{ text: 'Group1', items: [/* */] },

{ text: 'Group2', items: [/* */] }

]

}

]

}

}

# 侧边栏(sidebar)

要启用侧边栏,请使用 themeConfig.sidebar。基本配置需要一系列链接:// .vuepress/config.js

module.exports = {

themeConfig: {

sidebar: [

'/',

'/page-a',

['/page-b', 'Explicit link text']

]

}

}

你可以省略 .md 扩展名,以 / 结尾的路径被推断为 */README.md 。该链接的文本是自动推断的(从页面的第一个标题或 YAML front matter 中的显式标题)。如果你希望明确指定链接文本,请使用 [link,text] 形式的数组。

# 嵌套标题链接(nested header links)

侧边栏自动显示当前激活页面中标题的链接,嵌套在页面本身的链接下。你可以使用 themeConfig.sidebarDepth 自定义此行为。默认深度是 1,它提取 h2 标题。将其设置为 0 将禁用标题链接,最大值为2,同时提取 h2 和 h3 标题。

页面也可以在使用 YAML front matter 时覆盖此值:---

sidebarDepth: 2

---

# 侧边栏组(sidebar groups)

你可以使用对象将侧边栏链接分成多个组:// .vuepress/config.js

module.exports = {

themeConfig: {

sidebar: [

{

title: 'Group 1',

collapsable: false,

children: [

'/'

]

},

{

title: 'Group 2',

children: [ /* ... */ ]

}

]

}

}

侧边栏组默认情况下是可折叠的。你可以强制一个组始终以 collapsable:false 打开。

# 多个侧边栏(multiple sidebars)

如果你希望为不同的页面组显示不同的侧边栏,请先将页面组织到目录中:.

├─ README.md

├─ foo

│  ├─ README.md

│ ├─ one.md

│ └─ two.md

└─ bar

├─ README.md

├─ three.md

└─ four.md

然后,使用以下侧边栏配置:// .vuepress/config.js

module.exports = {

themeConfig: {

sidebar: {

// 侧边栏在 /foo/ 上

'/foo/': [

'',

'one',

'two'

],

// 侧边栏在 /bar/ 上

'/bar/': [

'',

'three',

'four'

]

}

}

}

# 单页自动补充工具栏(auto sidebar for single pages)

如果你希望自动生成仅包含当前页面的标题链接的侧边栏,则可以在该页面上使用 YAML front matter:---

sidebar: auto

---

# 禁用侧边栏(disabling the sidebar)

你可以使用 YAML front matter 禁用特定页面上的侧边栏:---

sidebar: false

---

# 上一页/下一页链接(prev / next links)

根据激活页面的侧边栏顺序自动推断上一个和下一个链接。你也可以使用 YAML front matter 来显式覆盖或禁用它们:---

prev: ./some-other-page

next: false

---

# GitHub 仓库和编辑链接

提供 themeConfig.repo 会在导航栏中自动生成一个 GitHub 链接,并在每个页面的底部显示「编辑此页面」链接。// .vuepress/config.js

module.exports = {

themeConfig: {

// 假定 GitHub。也可以是一个完整的 GitLab 网址

repo: 'vuejs/vuepress',

// 如果你的文档不在仓库的根部

docsDir: 'docs',

// 可选,默认为 master

docsBranch: 'master',

// 默认为 true,设置为 false 来禁用

editLinks: true

}

}

# 简单的 CSS 覆盖

如果你希望对默认主题的样式应用简单覆盖,则可以创建一个 .vuepress/override.styl 文件。 这是 Stylus 文件,但你也可以使用普通的 CSS 语法。

有几个颜色变量可以调整:// 显示默认值

$accentColor = #3eaf7c

$textColor = #2c3e50

$borderColor = #eaecef

$codeBgColor = #282c34

# custom page class

Sometimes, you may need to add a unique class for a specific page so that you can target content on that page only in custom CSS. You can add a class to the theme container div with pageClass in YAML front matter:---

pageClass: custom-page-class

---

Then you can write CSS targeting that page only:.theme-container.custom-page-class {

/* page-specific rules */

}

# 特定页面的自定义布局(custom layout for specific pages)

默认情况下,每个 *.md 文件的内容都会显示在一个

容器中,以及侧边栏,自动生成的编辑链接和 prev/next 链接。如果你希望使用完全自定义的组件代替页面(同时只保留导航栏),则可以使用 YAML front matter 再次指定要使用的组件:---

layout: SpecialLayout

---

这将为给定页面渲染 .vuepress/components/SpecialLayout.vue。

# Ejecting

You can copy the default theme source code into .vuepress/theme to fully customize the theme using the vuepress eject [targetDir] command. Note, however, once you eject, you are on your own and won’t be receiving future updates or bug fixes to the default theme even if you upgrade VuePress.

vuepress侧边栏配置_VuePress默认主题配置(default theme config) - VuePress中文网相关推荐

  1. vue中webpack默认配置_Vue-cli 中 Webpack 配置优化(一)

    一.前言 最近一段时间在学习 Webpack 方面的知识.在学习的过程中主要配置的是 webpack.config.js 文件. 但是在 Vue-cli 3.x 下,已经对 Webpack 做了深度的 ...

  2. idea安装后的配置、最详细的配置、必要的配置

    idea现在已经成为java开发人员的第一选择工具,在新安装idea后需要进行一定的配置,这些必要的配置可以大大的提高我们的开发效率,本文提供了一些在新安装idea后的一些必要的配置!详细的配置教程说 ...

  3. nginx 配置详解_Nginx 配置详解

    序言 Nginx是lgor Sysoev为俄罗斯访问量第二的http://rambler.ru站点设计开发的.从2004年发布至今,凭借开源的力量,已经接近成熟与完善. Nginx功能丰富,可作为HT ...

  4. vuepress侧边栏配置_VuePress搭建静态博客网站

    VuePress是什么 仅从单词上来看就是vue和press,press除了按压的意思外,还有报刊杂志和出版社等意思,所以可以理解为由vue驱动的出版工具.换个说法就是静态博客编写工具.后六字应该都不 ...

  5. Hexo+next主题配置踩的坑

    Hexo+next主题配置踩的坑 下载安装完next主题后才发现一堆的坑.由于next的版本不同.所以有的配置文件和网上的教程不大一样.自己踩了N多坑,于是打算记录一下.于是自己试了好几天才差不多配置 ...

  6. hexo个人博客搭建(二)butterfly主题配置

    Butterfly主题安装文档(二)之主题配置 一.回顾安装butterfly主题 1.在hexo项目根目录下执行操作clone主题 git clone -b master https://githu ...

  7. VuePress快速上手(默认主题)

    文章目录 简要介绍 安装vuePress 步骤一: 步骤二: 步骤三:现有项目中使用 VuePress 管理文档,从此处开始 步骤四: 步骤五: 步骤六: 完善目录结构(满足基本需求) 开启首页展示 ...

  8. 使用 github 仓库搭建 Hexo教程,Hexo配置文件解读,Hexo安装next主题及主题配置,美化

    这是之前写的文章了,重新补一补,把另外写的都和在一起了,出问题方便找 搭建Hexo 准备 安装 nodejs 安装 git 可以看我之前的博客,好像有写安装方法 安装hexo-cli 中文官网 安装是 ...

  9. Hexo 主题配置 - NexT

    hexo-theme-next 主题配置大全,图文并茂,持续更新中. 1 安装 NexT 主题 参考 hexo-theme-next 主题官网 1.1 下载 NexT 主题 建议你使用 克隆最新版本 ...

最新文章

  1. 少壮不努力,老大背单词
  2. Android--使用XMLPull解析xml
  3. 渲染器跑分_这一次会挤牙膏吗?9400F/10400跑分对比
  4. 使用Azure云原生构建博客是怎样一种体验?(上篇)
  5. mysql中设置字符_MySQL中设置默认字符集的方法
  6. 网络摄像头 java_在Java中从网络摄像头捕获图像?
  7. PRML exercises 10.3 解析
  8. 基于中颖SH88F516驱动TM1640的LED数码管驱动程序
  9. 找回QQ很久以前删除过的QQ好友
  10. 《派派APP》实现方式、运营模式、盈利手段
  11. AtCoder Regular Contest 115 C - ℕ Coloring
  12. mysql 多条件求和_sql多条件求和-sql条件求和-sql求和且和满足条件
  13. 电商网站的价格大概多少钱?
  14. 一个五年架构师为什么基本年薪酬可以达到50万?
  15. 【管理篇 / 登录】❀ 03. USB线连接登录 ❀ FortiGate 防火墙
  16. 终极单词index 排序 C-D
  17. 支付宝退款工具类整理
  18. 画家王俊杰主编中国艺苑大型名家活动发布会
  19. G-08 魔王语言解释 (20 分)
  20. Python基础第一课

热门文章

  1. 比较详细的HC-SR04超声波传感器数据及机器人避障的应用方法
  2. npm下载依赖时的问题
  3. 冲突杀手meld -- git使用meld作为对比或合并工具_zhou
  4. The retrospective material for final English exam unit_3 disease
  5. cifar 10 最高正确率
  6. vanishing point detection in autopilot
  7. 安卓手机如何设置http代理?
  8. 中文、\uxxxx、\x xx、base64的相互转码
  9. zblog忘记后台密码怎么办 官方解决方案
  10. hexo图片展示-blog图床迁移至七牛云