feat: meta.json hidden field for URL-routable-but-sidebar-excluded pages (0.1.2-alpha) - #22
Merged
Conversation
…ing without sidebar visibility
…Builder, ensuring correct sidebar exclusion and URL resolution
…tion of hidden pages functionality and version bump in Directory.Build.props
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
"hidden"support tometa.jsonand the underlyingNavigationGraph. Enables a docs site to have pages that route (URLs resolve, direct links work, package-selector navigation works) but never appear in the sidebar tree.Dogfood-driven: surfaced building shelldocs.dev where package landing pages need to be reachable via the sidebar package selector without also cluttering the lower sidebar with a redundant "Packages" section.
The API
{ "title": "Documentation", "pages": ["introduction", "getting-started"], "hidden": ["components", "cli", "markdown", "core", "tokens"] }Slugs (or folder names) in
hiddenare excluded from:pagesrendering (if double-listed,hiddenwins)GetPrevNextskips them)Flatten()iterationBut remain URL-routable:
NavigationGraph.ResolveByUrl("/hidden-page")returns the node, direct links + package-selector navigation work.How it works under the hood
NavigationGraphBuilder.BuildFoldernow threads ahiddencollection through recursion. Whenmeta.Hiddenseeds a slug, the corresponding page (or folder-subtree, wrapped in a synthetic section node soIndex()can recurse it) is pushed into that collection.NavigationGraphconstructor accepts an optionalhiddenPagesparam and indexes them into_byUrlonly — never into_flatPages, never intoRoot.Children.Release chore bundled
Rather than splitting into two branches, folded the release chore in:
Directory.Build.props:<Version>0.1.2-alpha</Version>src/ShellDocs.CLI/Commands/InitCommand.cs:ShellDocsVersionconst bumped alongside (per the dual-bump note indocs/RELEASING.md)CHANGELOG.md:[0.1.2-alpha]entry + compare-link footerPost-merge,
git tag v0.1.2-alpha && git push origin v0.1.2-alphapublishes cleanly through the existing Trusted Publishing workflow.Test plan
dotnet build shelldocs.slnx— clean, 0 warnings, 0 errorsdotnet test shelldocs.slnx— 147 / 147 passing (+4 new inNavigationGraphBuilderTests)bash scripts/pack-dry-run.sh— all 6 packages pack cleanly at0.1.2-alphaNew tests (
NavigationGraphBuilderTests)ResolveByUrlhiddentakes precedence overpages(slug in both stays hidden)Files touched
src/ShellDocs.Core/MetaJson.cs— newHiddenfieldsrc/ShellDocs.Core/NavigationGraph.cs— optionalhiddenPagesconstructor param +IndexHiddenhelpersrc/ShellDocs.Core/NavigationGraphBuilder.cs—BuildFolderthreads ahiddenlist, seeds frommeta.Hidden, wraps hidden folders in synthetic sections for URL indexingtests/ShellDocs.Tests/NavigationGraphBuilderTests.cs— 4 new testsDirectory.Build.props,src/ShellDocs.CLI/Commands/InitCommand.cs,CHANGELOG.md— release chore