docs: render minimalVersion badge from layout#2203
Conversation
- Add minimalVersion to docs collection schemas (docsv3, docsv4, docsv5) - Render version badge in docs page header when frontmatter has minimalVersion - Badge shows vX.Y (e.g. v3.12), info color, with aria-label for a11y Complements nuxt/nuxt#34485: API docs set minimalVersion in frontmatter; this repo displays the badge so global inline badges are not needed.
|
@Ibochkarev is attempting to deploy a commit to the Nuxt Team on Vercel. A member of the Team first needs to authorize it. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds an optional Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@content.config.ts`:
- Around line 217-220: The schema currently defines minimalVersion as
z.string().optional(), which rejects numeric YAML frontmatter and leaves
templates calling page.minimalVersion?.trim() unsafe; update the schema for
minimalVersion to accept z.union([z.string(),
z.number()]).optional().transform(v => v === undefined ? undefined :
String(v).trim()) so numbers like 3.12 become trimmed strings, and apply the
same change to the other occurrences of minimalVersion in the file (the other
schema blocks near the same section) to keep behavior consistent with the Vue
template.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a5ddbb40-498b-456d-b52c-e9080128d9a8
📒 Files selected for processing (2)
app/pages/docs/[...slug].vuecontent.config.ts
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
Co-authored-by: Robin <robin.kehl@singular-it.de>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@content.config.ts`:
- Line 221: Update the minimalVersion schemas at all three occurrences in the
content configuration to accept both YAML strings and numbers, then normalize
either input to a trimmed string while preserving undefined values. Replace the
current z.string()-only validation used by each minimalVersion field.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
Co-authored-by: Robin <robin.kehl@singular-it.de>
Co-authored-by: Robin <robin.kehl@singular-it.de>
Co-authored-by: Robin <robin.kehl@singular-it.de>
Co-authored-by: Robin <robin.kehl@singular-it.de>
|
failure is: |
Render the minimal Nuxt version badge in the docs page layout when
minimalVersionis set in frontmatter, so API docs in nuxt/nuxt do not need to repeat global badges in each markdown file.Why: In nuxt/nuxt#34485, API pages get
minimalVersionin frontmatter. OrbisK suggested rendering the badge from the layout here instead of inline in every doc. This change adds that: the docs layout readsminimalVersionand shows avX.Ybadge next to the page title.Changes:
minimalVersionto docs collection schemas (docsv3, docsv4, docsv5) incontent.config.ts.[...slug].vue, render a small info badge next to the title whenpage.minimalVersionis present; use:aria-labelfor accessibility.Refs nuxt/nuxt#34485