Skip to content

feat: meta.json hidden field for URL-routable-but-sidebar-excluded pages (0.1.2-alpha) - #22

Merged
Shewart merged 4 commits into
mainfrom
feat/meta-json-hidden
Jul 28, 2026
Merged

feat: meta.json hidden field for URL-routable-but-sidebar-excluded pages (0.1.2-alpha)#22
Shewart merged 4 commits into
mainfrom
feat/meta-json-hidden

Conversation

@Shewart

@Shewart Shewart commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds "hidden" support to meta.json and the underlying NavigationGraph. 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 hidden are excluded from:

  • Explicit pages rendering (if double-listed, hidden wins)
  • Auto-append tail (0.1.1's default behavior for unreferenced files)
  • Prev/Next walking (GetPrevNext skips them)
  • Flatten() iteration

But remain URL-routable: NavigationGraph.ResolveByUrl("/hidden-page") returns the node, direct links + package-selector navigation work.

How it works under the hood

NavigationGraphBuilder.BuildFolder now threads a hidden collection through recursion. When meta.Hidden seeds a slug, the corresponding page (or folder-subtree, wrapped in a synthetic section node so Index() can recurse it) is pushed into that collection. NavigationGraph constructor accepts an optional hiddenPages param and indexes them into _byUrl only — never into _flatPages, never into Root.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: ShellDocsVersion const bumped alongside (per the dual-bump note in docs/RELEASING.md)
  • CHANGELOG.md: [0.1.2-alpha] entry + compare-link footer

Post-merge, git tag v0.1.2-alpha && git push origin v0.1.2-alpha publishes cleanly through the existing Trusted Publishing workflow.

Test plan

  • dotnet build shelldocs.slnx — clean, 0 warnings, 0 errors
  • dotnet test shelldocs.slnx147 / 147 passing (+4 new in NavigationGraphBuilderTests)
  • bash scripts/pack-dry-run.sh — all 6 packages pack cleanly at 0.1.2-alpha

New tests (NavigationGraphBuilderTests)

  • Hidden slug excluded from sidebar but URL resolves via ResolveByUrl
  • Hidden folder excluded from sidebar but each child URL still resolves
  • hidden takes precedence over pages (slug in both stays hidden)
  • Hidden slug excluded from the auto-append tail (was the corner case that surfaced the whole need)

Files touched

  • src/ShellDocs.Core/MetaJson.cs — new Hidden field
  • src/ShellDocs.Core/NavigationGraph.cs — optional hiddenPages constructor param + IndexHidden helper
  • src/ShellDocs.Core/NavigationGraphBuilder.csBuildFolder threads a hidden list, seeds from meta.Hidden, wraps hidden folders in synthetic sections for URL indexing
  • tests/ShellDocs.Tests/NavigationGraphBuilderTests.cs — 4 new tests
  • Directory.Build.props, src/ShellDocs.CLI/Commands/InitCommand.cs, CHANGELOG.md — release chore

@Shewart
Shewart merged commit b7cc15c into main Jul 28, 2026
1 check passed
@Shewart
Shewart deleted the feat/meta-json-hidden branch July 28, 2026 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant