Skip to content

docs: exempt patterns from cf _routes.json#2136

Merged
danielroe merged 5 commits intomainfrom
docs/prerender
Feb 25, 2026
Merged

docs: exempt patterns from cf _routes.json#2136
danielroe merged 5 commits intomainfrom
docs/prerender

Conversation

@danielroe
Copy link
Member

@danielroe danielroe commented Feb 25, 2026

🔗 Linked issue

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

this works around an issue in CF pages, which has a limit of 100 static pages, so the ~239 prerendered pages/files in this build were getting silently truncated, which was why nuxt-picture and use-img were returning 404s (we couldn't render them via SSR)

cc: @pi0 @larbish

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 25, 2026

Deploying nuxt-image with  Cloudflare Pages  Cloudflare Pages

Latest commit: 658a264
Status: ✅  Deploy successful!
Preview URL: https://fd30ee6f.nuxt-image.pages.dev
Branch Preview URL: https://docs-prerender.nuxt-image.pages.dev

View logs

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 25, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@nuxt/image@2136

commit: 658a264

@coderabbitai
Copy link

coderabbitai bot commented Feb 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ecc9d47 and 9526bce.

📒 Files selected for processing (1)
  • docs/nuxt.config.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/nuxt.config.ts

📝 Walkthrough

Walkthrough

Adds a nitro configuration block to docs/nuxt.config.ts that sets cloudflare.pages.routes.exclude to an array of route patterns. The array contains: /get-started/*, /usage/*, /providers/*, /advanced/*, /playground, /__nuxt_content/*, and /raw/*, instructing Nitro/Cloudflare Pages to exclude those routes from prerendering. No other code, error handling, or control flow changes were made.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding exempt patterns to Cloudflare Pages routes configuration in the docs Nuxt config.
Description check ✅ Passed The description provides meaningful context about the change—explaining the Cloudflare Pages 100-static-page limit and how the exemptions work around truncation issues causing 404 errors.
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 docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch docs/prerender

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.

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 6.82%. Comparing base (d6b5bd1) to head (978e2e3).

Files with missing lines Patch % Lines
docs/nuxt.config.ts 0.00% 5 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main   #2136      +/-   ##
========================================
- Coverage   6.83%   6.82%   -0.01%     
========================================
  Files         80      80              
  Lines       3732    3737       +5     
  Branches     142     142              
========================================
  Hits         255     255              
- Misses      3427    3432       +5     
  Partials      50      50              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@danielroe danielroe changed the title docs: explicitly prerender nuxt-picture page docs: exempt patterns from cf routes.json Feb 25, 2026
@danielroe danielroe changed the title docs: exempt patterns from cf routes.json docs: exempt patterns from cf _routes.json Feb 25, 2026
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 `@docs/nuxt.config.ts`:
- Around line 13-21: The exclude list in the Nuxt config currently uses patterns
like '/usage/*' which do not match the parent landing pages (e.g., '/usage');
update the exclude array (the one defined in docs/nuxt.config.ts) to include
explicit parent route entries for each section (add '/get-started', '/usage',
'/providers', '/advanced', '/playground', '/__og-image__', '/__nuxt_content',
'/raw' alongside the existing wildcard patterns) so the section landing pages
are also excluded by Cloudflare Pages routing.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 978e2e3 and ecc9d47.

📒 Files selected for processing (1)
  • docs/nuxt.config.ts

Comment on lines +13 to +21
exclude: [
'/get-started/*',
'/usage/*',
'/providers/*',
'/advanced/*',
'/playground',
'/__og-image__/*',
'/__nuxt_content/*',
'/raw/*',
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

Nitro cloudflare.pages.routes.exclude wildcard pattern matching documentation

💡 Result:

In Nitro’s Cloudflare Pages preset, nitro.cloudflare.pages.routes.exclude is used to generate/override the Cloudflare Pages _routes.json exclude list, so the wildcard behavior is whatever Cloudflare Pages supports in _routes.json. In practice, treat these as Cloudflare Pages route globs, not regex. [1]

Wildcard matching rules (Cloudflare Pages _routes.json)

  • Only the * wildcard is used.
  • exclude and include entries accept wildcards.
  • exclude always takes priority over include.
  • * matches any number of path segments (including /). Example: /users/* matches everything after /users/. [1]

Example (Nitro config)

export default defineNuxtConfig({
  nitro: {
    cloudflare: {
      pages: {
        routes: {
          exclude: [
            "/docs/*",
            "/blog/*",
          ],
        },
      },
    },
  },
})

This is commonly used to avoid generating huge per-page excludes (Cloudflare Pages has a 100-route limit), by excluding entire pre-rendered sections via wildcards. [2]

Sources: Cloudflare Pages routing / _routes.json wildcard behavior [1]; NuxtHub recipe showing nitro.cloudflare.pages.routes.exclude usage [2].


🏁 Script executed:

# Search for Nitro configuration examples in the codebase
fd -t ts -t js nitro.config | head -20

Repository: nuxt/image

Length of output: 223


🏁 Script executed:

# Search for cloudflare pages configuration patterns in docs
rg "cloudflare.pages" --type ts --type js -A 5 -B 2 | head -100

Repository: nuxt/image

Length of output: 36


Add explicit parent route patterns to exclude section landing pages.

Per Cloudflare Pages _routes.json documentation, the * wildcard in patterns like /usage/* matches "everything after /usage/", meaning it excludes only child routes, not the parent route itself (e.g., /usage). Section landing pages will not be excluded as intended without explicit parent route entries.

Suggested fix
         routes: {
           exclude: [
+            '/get-started',
             '/get-started/*',
+            '/usage',
             '/usage/*',
+            '/providers',
             '/providers/*',
+            '/advanced',
             '/advanced/*',
             '/playground',
             '/__og-image__/*',
             '/__nuxt_content/*',
             '/raw/*',
           ],
         },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
exclude: [
'/get-started/*',
'/usage/*',
'/providers/*',
'/advanced/*',
'/playground',
'/__og-image__/*',
'/__nuxt_content/*',
'/raw/*',
exclude: [
'/get-started',
'/get-started/*',
'/usage',
'/usage/*',
'/providers',
'/providers/*',
'/advanced',
'/advanced/*',
'/playground',
'/__og-image__/*',
'/__nuxt_content/*',
'/raw/*',
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/nuxt.config.ts` around lines 13 - 21, The exclude list in the Nuxt
config currently uses patterns like '/usage/*' which do not match the parent
landing pages (e.g., '/usage'); update the exclude array (the one defined in
docs/nuxt.config.ts) to include explicit parent route entries for each section
(add '/get-started', '/usage', '/providers', '/advanced', '/playground',
'/__og-image__', '/__nuxt_content', '/raw' alongside the existing wildcard
patterns) so the section landing pages are also excluded by Cloudflare Pages
routing.

@danielroe danielroe enabled auto-merge February 25, 2026 09:23
@danielroe danielroe disabled auto-merge February 25, 2026 09:29
@danielroe danielroe enabled auto-merge February 25, 2026 09:29
@danielroe danielroe disabled auto-merge February 25, 2026 09:29
@danielroe danielroe merged commit db20c7c into main Feb 25, 2026
10 checks passed
@danielroe danielroe deleted the docs/prerender branch February 25, 2026 09:29
@github-actions github-actions bot mentioned this pull request Feb 25, 2026
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