Skip to content

[Feature request] Auto Sidebar Per Page #17

@nruffing

Description

@nruffing

Clear and concise description of the problem

The auto sidebar feature of the default theme is quite useful, especially in cases where the pages are autogenerated documentation from something like TypeDoc.

Currently you can only use the auto feature on all pages or manually specify the sidebar for every page. It would be great if you could turn the feature on per page as well.

I was able to hack it to make it work for the data-grid-vue site using vue router nav guards but its not maintainable and would probably be pretty easy to implement in the theme unless the changes to not use the vue router are going to make the auto sidebar feature more difficult to implement in general.
https://github.com/nruffing/data-grid-vue/blob/main/vuepress/.vuepress/client.ts#L63

Suggested solution

Implement passing 'auto' to a SidebarConfigArray for a given page in the theme's config object.

We could also change SidebarConfigObject to allow a string directly.

export type SidebarAuto = 'auto'
export type SidebarConfigObject = Record<string, SidebarConfigArray | SidebarAuto>
sidebar: {
  '/guide/': [
    {
      text: 'Guide',
      children: [
        '/guide/README.md',
        '/guide/columns.md',
        '/guide/sorting.md',
        '/guide/filtering.md',
        '/guide/paging.md',
        '/guide/more-coming-soon.md',
      ],
    },
  ],
  '/generated/': 'auto'
  '/dotnet-generated/': 'auto',
},

Alternative

No response

Additional context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions