Skip to content

docs: render minimalVersion badge from layout#2203

Open
Ibochkarev wants to merge 11 commits into
nuxt:mainfrom
Ibochkarev:docs/minimal-version-badge-layout
Open

docs: render minimalVersion badge from layout#2203
Ibochkarev wants to merge 11 commits into
nuxt:mainfrom
Ibochkarev:docs/minimal-version-badge-layout

Conversation

@Ibochkarev

@Ibochkarev Ibochkarev commented Mar 11, 2026

Copy link
Copy Markdown

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

vercel Bot commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

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

A member of the Team first needs to authorize it.

@Ibochkarev
Ibochkarev marked this pull request as ready for review March 11, 2026 16:51
@Ibochkarev
Ibochkarev requested a review from atinux as a code owner March 11, 2026 16:51
@coderabbitai

coderabbitai Bot commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds an optional minimalVersion field to three Nuxt Content collections, trimming provided string values. Updates the docs page header to render the page title and conditionally show a UBadge labeled with the minimum version and an accessible label. Other header content remains unchanged.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: rendering the minimalVersion badge from the docs layout.
Description check ✅ Passed The description accurately matches the changes by explaining the layout badge and schema updates.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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

vercel Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
nuxt Error Error Jul 18, 2026 2:49pm

Request Review

Comment thread app/pages/docs/[...slug].vue Outdated
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
Comment thread content.config.ts Outdated
Comment thread content.config.ts Outdated
Comment thread content.config.ts Outdated
Co-authored-by: Robin <robin.kehl@singular-it.de>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 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

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 07aafd2f-1b76-4b86-b173-2e1e4793a4f7

📥 Commits

Reviewing files that changed from the base of the PR and between 8c40d1f and 95707c8.

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

Comment thread content.config.ts Outdated
Comment thread content.config.ts Outdated
Co-authored-by: Robin <robin.kehl@singular-it.de>
Comment thread content.config.ts Outdated
Comment thread content.config.ts Outdated
Comment thread content.config.ts Outdated
Ibochkarev and others added 3 commits July 18, 2026 00:00
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>
@danielroe

Copy link
Copy Markdown
Member

failure is:

[error] [nuxt:hub] Failed to apply query `.vercel/output/functions/__fallback.func/db/queries/content-database-001.sql`
SQLITE_UNKNOWN: SQLite error: table _content_docsv5 has 13 columns but 14 values were supplied
[ELIFECYCLE] Command failed with exit code 1.
Error: Command "pnpm run build" exited with 1

@danielroe

Copy link
Copy Markdown
Member

@atinux @HugoRCD how are we handling schema migrations with nuxt/hub? do we need to do something special here?

@HugoRCD

HugoRCD commented Jul 20, 2026

Copy link
Copy Markdown
Member

@atinux @HugoRCD how are we handling schema migrations with nuxt/hub? do we need to do something special here?
Yes, but only as far as the schema is concerned, that's a bug in Content, it should be handled automatically 🤔

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.

5 participants