Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions docs/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@ export default defineNuxtConfig({
name: 'Nuxt Image',
},
compatibilityDate: '2025-08-07',
nitro: {
cloudflare: {
pages: {
routes: {
exclude: [
'/get-started/*',
'/usage/*',
'/providers/*',
'/advanced/*',
'/playground',
'/__nuxt_content/*',
'/raw/*',
Comment on lines +13 to +20
Copy link
Copy Markdown

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.

],
},
},
},
},
llms: {
domain: 'https://image.nuxt.com',
description: 'Nuxt Image is a module for Nuxt to optimize image for best performance.',
Expand Down
Loading