Skip to content

docs: render minimalVersion badge from layout#2203

Open
Ibochkarev wants to merge 2 commits intonuxt:mainfrom
Ibochkarev:docs/minimal-version-badge-layout
Open

docs: render minimalVersion badge from layout#2203
Ibochkarev wants to merge 2 commits intonuxt:mainfrom
Ibochkarev:docs/minimal-version-badge-layout

Conversation

@Ibochkarev
Copy link

Render the minimal Nuxt version badge in the docs page layout when minimalVersion is 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 minimalVersion in frontmatter. OrbisK suggested rendering the badge from the layout here instead of inline in every doc. This change adds that: the docs layout reads minimalVersion and shows a vX.Y badge next to the page title.

Changes:

  • Add minimalVersion to docs collection schemas (docsv3, docsv4, docsv5) in content.config.ts.
  • In docs [...slug].vue, render a small info badge next to the title when page.minimalVersion is present; use :aria-label for accessibility.

Refs nuxt/nuxt#34485

- 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.
@vercel
Copy link
Contributor

vercel bot commented Mar 11, 2026

@Ibochkarev is attempting to deploy a commit to the Nuxt Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link

coderabbitai bot commented Mar 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4f7e0a63-a1a0-4da4-9b18-6920c7edbde9

📥 Commits

Reviewing files that changed from the base of the PR and between 82262de and 92a39e7.

📒 Files selected for processing (1)
  • content.config.ts

📝 Walkthrough

Walkthrough

Adds an optional minimalVersion field to three Nuxt Content collections (docsv5, docsv4, docsv3) with a schema accepting string or number and transforming it to a trimmed string when present. Updates the Vue page component to render the page title via a UPageHeader title slot and, if minimalVersion is provided, display a subtle badge labeled v{minimalVersion} with an appropriate aria-label. Existing headline and links rendering remain unchanged.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: rendering a minimalVersion badge from the docs layout, which is the core objective of this PR.
Description check ✅ Passed The description is clearly related to the changeset, providing context on why the change is needed and detailing the specific modifications made to support minimalVersion rendering.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between d38ce2d and 82262de.

📒 Files selected for processing (2)
  • app/pages/docs/[...slug].vue
  • content.config.ts

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