Auto-generate docs sidebar and content from .svx frontmatter#2
Merged
Conversation
Add a shared index.ts that globs all .svx files and derives both the section list (DocsContent) and sidebar groups (DocsSidebar) from frontmatter. Add `group` field to all .svx files so sidebar grouping is explicit and independent of the display-only `kicker` field. Adding a new doc now requires only a new .svx file. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Deploying coveragetracker-dev with
|
| Latest commit: |
4c3d4d6
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://8dc69bb7.coveragetracker-dev.pages.dev |
| Branch Preview URL: | https://refactor-docs-auto-sidebar.coveragetracker-dev.pages.dev |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
src/lib/docs-content/index.tsas a single source of truth: globs all.svxfiles, sorts by filename prefix, and exportssections(forDocsContent) andsidebarGroups(forDocsSidebar)groupfrontmatter field to all 15.svxfiles — needed because the existingkickerfield is a display label and doesn't map 1:1 to sidebar groups (e.g.how-it-workshaskicker: architecturebut belongs to the "Getting started" group)DocsSidebar.svelteto replace the hardcoded 22-line groups array with a one-line importDocsContent.svelteto replace its inline glob with an import from the shared moduleAdding a new doc now only requires a new
.svxfile withid,title, andgroupfrontmatter — no component edits needed.Test plan
pnpm dev— docs page renders all sections in correct order with correct sidebar groupspnpm check— no new type errorspnpm build— clean prerender build🤖 Generated with Claude Code