Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Auto Sidebar Per Page #17

Closed
nruffing opened this issue Dec 30, 2023 · 3 comments · Fixed by #30
Closed

[Feature request] Auto Sidebar Per Page #17

nruffing opened this issue Dec 30, 2023 · 3 comments · Fixed by #30
Assignees
Labels

Comments

@nruffing
Copy link
Contributor

nruffing commented Dec 30, 2023

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

@nruffing
Copy link
Contributor Author

@meteorlxy @Mister-Hope thoughts? I can put up a PR for this if we want to try this out.

@Mister-Hope
Copy link
Member

LGTM

@Mister-Hope
Copy link
Member

Mister-Hope commented Dec 30, 2023

You may check other features in my theme hope, this feature is called heading in my theme.https://theme-hope.vuejs.press/guide/layout/sidebar.html

If you think that structure sidebar is useful, then we 'd better not calling this one as auto.

@nruffing

@nruffing nruffing self-assigned this Jan 13, 2024
nruffing added a commit to nruffing/vuepress-ecosystem that referenced this issue Jan 21, 2024
nruffing added a commit to nruffing/vuepress-ecosystem that referenced this issue Jan 21, 2024
nruffing added a commit to nruffing/vuepress-ecosystem that referenced this issue Jan 21, 2024
nruffing added a commit to nruffing/vuepress-ecosystem that referenced this issue Jan 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants