Skip to content

Commit

Permalink
feat($theme-default): allow 'auto' in defined sidebars (close: #1252) (
Browse files Browse the repository at this point in the history
  • Loading branch information
bobheadxi authored Jun 14, 2020
1 parent 3c94f71 commit 597f83b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/@vuepress/theme-default/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ export function resolveSidebarItems (page, regularPath, site, localePath) {
return []
} else {
const { base, config } = resolveMatchingConfig(regularPath, sidebarConfig)
if (config === 'auto') {
return resolveHeaders(page)
}
return config
? config.map(item => resolveItem(item, pages, base))
: []
Expand Down
2 changes: 2 additions & 0 deletions packages/docs/docs/theme/default-theme-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ module.exports = {
'four' /* /bar/four.html */
],

'/baz/': 'auto', /* automatically generate single-page sidebars */

// fallback
'/': [
'', /* / */
Expand Down

0 comments on commit 597f83b

Please sign in to comment.