Skip to content

docs: render minimalVersion badge from layout#2203

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

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

Conversation

@Ibochkarev
Copy link
Copy Markdown

@Ibochkarev Ibochkarev commented Mar 11, 2026

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
Copy Markdown
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
Copy Markdown
Contributor

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: 58e71302-7cef-4f15-a07d-fe260c8b52fc

📥 Commits

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

📒 Files selected for processing (1)
  • app/pages/docs/[...slug].vue

📝 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 docs page component to render the page title via a UPageHeader #title slot and, when page.minimalVersion exists, display a subtle UBadge labeled v{minimalVersion} with an aria-label indicating the minimum Nuxt version. Other header links, body rendering, TOC, and drawers are unchanged.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a minimalVersion badge to the docs layout that renders when the field is set.
Description check ✅ Passed The description is clearly related to the changeset, explaining the motivation, implementation details, and files modified for the minimalVersion badge feature.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

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

Copy link
Copy Markdown
Contributor

@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

Comment thread content.config.ts Outdated
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nuxt Error Error May 4, 2026 4:44pm

Comment thread app/pages/docs/[...slug].vue Outdated
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
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.

2 participants