Skip to content

fix(metadata): build robots directives like Next.js - #4755

Open
ash1day wants to merge 1 commit into
cloudflare:mainfrom
ash1day:fix/metadata-robots-directives
Open

ash1day wants to merge 1 commit into
cloudflare:mainfrom
ash1day:fix/metadata-robots-directives

Conversation

@ash1day

@ash1day ash1day commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

A robots directive set to false renders as a directive that does not exist:

export const metadata = {
  robots: { index: true, nosnippet: false, googleBot: { index: false, noarchive: false } },
};
<!-- main f4f6d48 -->
<meta name="robots" content="index, nonosnippet">
<meta name="googlebot" content="noindex, nonoarchive">
<!-- Next.js 16.2.6 -->
<meta name="robots" content="index">
<meta name="googlebot" content="noindex">

The renderer prefixed no to every false key. In Next.js only index and follow have a no form; the other directives are left out when false.

This change ports resolveRobotsValue (packages/next/src/lib/metadata/resolvers/resolve-basics.ts). The directives also come out in Next.js's fixed order instead of the object's key order.

Verification

Five pages with string, object and googleBot robots: the robots and googlebot tags equal Next.js 16.2.6 (next start) on vite preview (all five) and workers.dev (the two with false directives).

Tests

tests/features.test.ts: directives given out of order with false values, for both tags.

A directive set to false rendered as an invalid one (nosnippet: false became
"nonosnippet"); only index and follow have a no form. Port
resolveRobotsValue, which also fixes the directive order.
@clanky-the-clanker

Copy link
Copy Markdown

This pull request was not reviewed automatically because its author does not have write access to this repository. A maintainer with write access can start a review by commenting clanky review (or clanker review or @clanky-the-clanker review), optionally followed by instructions (e.g. clanky review focus on the retry logic).

@pkg-pr-new

pkg-pr-new Bot commented Nov 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vinext/cloudflare

npm i https://pkg.pr.new/@vinext/cloudflare@4755

create-vinext-app

npm i https://pkg.pr.new/create-vinext-app@4755

@vinext/types

npm i https://pkg.pr.new/@vinext/types@4755

vinext

npm i https://pkg.pr.new/vinext@4755

@cloudflare/workers-response-store

npm i https://pkg.pr.new/@cloudflare/workers-response-store@4755

commit: 3ba7140

@github-actions

Copy link
Copy Markdown
Contributor

Performance benchmarks

Compared 3ba7140 against base 027d6d2 using alternating same-runner rounds. Next.js was unchanged and skipped.

2 improved · 0 regressed · 5 within ±1.5%

Scenario Framework Baseline Current Change
Client bundle size (gzip) vinext 152.5 KB 152.5 KB ⚫ 0.0%
Client entry size (gzip) vinext 140.8 KB 140.8 KB ⚫ 0.0%
Dev server cold start vinext 1.80 s 1.78 s ⚫ -1.2%
Dev server cold start (large Pages Router app) vinext 13.33 s 12.97 s 🟢 -2.7%
Production build time vinext 2.03 s 1.96 s 🟢 -3.5%
RSC entry closure size (gzip) vinext 143.0 KB 143.1 KB ⚫ +0.0%
Server bundle size (gzip) vinext 250.9 KB 251.0 KB ⚫ +0.0%

View detailed results and traces

🟢 improvement · 🔴 regression · ⚫ change below 1.5% · paired base/head

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