---
title: "Route Rules"
description: "Learn how to use route rules to customise your OG Image."
canonical_url: "https://nuxtseo.com/docs/og-image/guides/route-rules"
last_updated: "2026-05-07T12:25:35.271Z"
---

In some cases, you'll want to apply OG Image setting for a subset of pages.

You can handle this even easier
with the route rule merging.

This lets you provide a `ogImage` key that will be either used or merged into the existing OG Image options.

For example, this documentation website uses it to set the `icon` depending on your path.

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  routeRules: {
    '/og-image/**': {
      ogImage: {
        props: { icon: 'carbon:image-search' }
      }
    }
  }
})
```

## Wildcard Route Rules Warning

Using wildcard route rules like `/**` with caching options (`swr`, `isr`, or `cache`) can break OG Image routes.

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  routeRules: {
    // ⚠️ This will break og-image routes
    '/**': { swr: 60 * 4 },
  }
})
```

This is due to a [known Nitro limitation](https://github.com/nitrojs/nitro/issues/1751) where you cannot exclude specific routes from wildcard cache rules.

**Workaround:** Use specific route patterns instead of wildcards:

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  routeRules: {
    '/blog/**': { swr: 60 * 4 },
    '/products/**': { swr: 60 * 4 },
    // Add specific patterns for your routes
  }
})
```
