我使用VuePress和NetlifyCMS作为内容管理。
我有 3 个集合(设计、前端和后端),其中包含不定数量的页面。这些页面是通过NetlifyCMS 仪表板创建的,并添加到定义的文件夹中。
- 新的设计页面被添加到设计文件夹中。
- 新的前端页面被添加到前端文件夹中。
- [...]
这工作正常,但我面临一个问题。
由于我的新页面未在侧边栏配置中定义,因此无法从侧边栏界面中使用它们。在保持与下面相同的侧边栏格式的同时,我怎么能做到这一点?
配置.js
[...],
sidebar: {
'/design/': [{
title: 'Design',
children: [
'',
'foo 1',
'foo 2'
]
}],
'/front-end/': [{
title: 'Front-end',
children: [
'',
'bar 1',
'bar 2'
]
}],
'/back-end/': [{
title: 'Back-end',
children: [
'',
'baz 1',
'baz 2'
]
}]
},
[...]
配置.yml
[...],
collections:
- name: "design"
label: "Design"
folder: "docs/design"
create: true
slug: "{{slug}}"
fields:
- {label: "Title", name: "title", widget: "string"}
- {label: "Body", name: "body", widget: "markdown"}
- name: "front-end"
label: "Front-end"
folder: "docs/front-end"
create: true
slug: "{{slug}}"
fields:
- {label: "Title", name: "title", widget: "string"}
- {label: "Body", name: "body", widget: "markdown"}
- name: "back-end"
label: "Back-end"
folder: "docs/back-end"
create: true
slug: "{{slug}}"
fields:
- {label: "Title", name: "title", widget: "string"}
- {label: "Body", name: "body", widget: "markdown"}