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: Settings file per folder #166

Open
DanielTrommel opened this issue Aug 1, 2024 · 0 comments
Open

Feature Request: Settings file per folder #166

DanielTrommel opened this issue Aug 1, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@DanielTrommel
Copy link

DanielTrommel commented Aug 1, 2024

Hi Jooy, love your module! While working with it, I thought of this way to make it even more modulair & allow for a more refined configuration:

Currently, the configuration for sidebar(s) is the one set of values, which apply to the whole sidebar. One thing I came across is that for some subfolders (for the same sidebar), I would like to have a different set of settings.

Proposal: for each folder, the module would check (while traversing) if there is a vitepress-sidebar.json file (or use the frontmatter section in index.md file that people probably already use to name the folder?); any setting in that file would override the value passed on from the parent folder.

The benefit is that the settings are contained within this folder, and one could easily move folder around. Refine per folder the file exclusions, not having to do this at the main level. Et cetera.

Looking at the code:

  • The settings check at the start needs to be refactored into a method e.g. checkSettings()
  • That vitepress-sidebar.json would need to be checked for existence first thing into the method, before this line at
    let directoryFiles: string[] = readdirSync(currentDir);
  • If it exists, read it, and update the inputted options
  • Then, call the checkSettings() again, to check for faults

Notes:

  • The scanStartPath folder (or documentRootPath if not set) could then have the same file, giving the default/initial values.
  • My guess is that some settings are not allowed in subfolders, like rootGroupText and includeRootIndexFile (anything related to the root folder?)
@DanielTrommel DanielTrommel added the bug Something isn't working label Aug 1, 2024
@DanielTrommel DanielTrommel changed the title Feature Request: Feature Request: Settings file per folder Aug 1, 2024
@jooy2 jooy2 added enhancement New feature or request and removed bug Something isn't working labels Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants