【发布时间】:2021-10-07 05:08:28
【问题描述】:
我希望每个页面都有自定义链接和不同的侧边栏我不希望我的标题在侧边栏中呈现为目录我希望有这样的自定义内容。
Node JS
-Lecture 1 Introduction
--Sub Lecture
-Lecture 2 Basics
--Sub Lecture
---Nested Lecture
所有讲座都是自定义链接。那我该怎么做呢。
【问题讨论】:
我希望每个页面都有自定义链接和不同的侧边栏我不希望我的标题在侧边栏中呈现为目录我希望有这样的自定义内容。
Node JS
-Lecture 1 Introduction
--Sub Lecture
-Lecture 2 Basics
--Sub Lecture
---Nested Lecture
所有讲座都是自定义链接。那我该怎么做呢。
【问题讨论】:
输入:false | 'auto' | SidebarConfigArray | SidebarConfigObject
默认:'auto'
详情:
侧边栏的配置。
您可以通过页面中的侧边栏 frontmatter 覆盖此全局选项。
设置为false 以禁用侧边栏。
如果设置为'auto',侧边栏会自动从页眉生成。
要手动配置侧边栏项,您可以将此选项设置为一个侧边栏数组,其中每个项可以是SidebarItem 对象或字符串:
SidebarItem 对象应该有一个text 字段,可以有一个可选的link 字段和一个可选的children 字段。 children 字段应该是一个边栏数组。SidebarItem对象,其text为页面标题,link为页面路由路径,children由页面标题自动生成。如果要为不同的子路径设置不同的侧边栏,可以将此选项设置为一个侧边栏对象:
要在外部和内部添加自定义链接,请参见:
module.exports = {
themeConfig: {
// sidebar object
// pages under different sub paths will use different sidebar
sidebar: {
'/guide/': [
{
text: 'Guide',
children: ['/guide/README.md', '/guide/getting-started.md'],
},
],
'/reference/': [
{
text: 'Reference',
children: ['/reference/cli.md', '/reference/config.md'],
},
],
},
},
}
欲了解更多信息,请参阅Sidebar Config
【讨论】: