docs: render minimalVersion badge from layout#2203
docs: render minimalVersion badge from layout#2203Ibochkarev wants to merge 2 commits intonuxt:mainfrom
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. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds an optional Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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
…e to trimmed string
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