Skip to content

Commit 597f83b

Browse files
authored
feat($theme-default): allow 'auto' in defined sidebars (close: #1252) (#2380)
1 parent 3c94f71 commit 597f83b

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

packages/@vuepress/theme-default/util/index.js

+3
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ export function resolveSidebarItems (page, regularPath, site, localePath) {
138138
return []
139139
} else {
140140
const { base, config } = resolveMatchingConfig(regularPath, sidebarConfig)
141+
if (config === 'auto') {
142+
return resolveHeaders(page)
143+
}
141144
return config
142145
? config.map(item => resolveItem(item, pages, base))
143146
: []

packages/docs/docs/theme/default-theme-config.md

+2
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,8 @@ module.exports = {
273273
'four' /* /bar/four.html */
274274
],
275275

276+
'/baz/': 'auto', /* automatically generate single-page sidebars */
277+
276278
// fallback
277279
'/': [
278280
'', /* / */

0 commit comments

Comments
 (0)