Route Rules · Nuxt OG Image · Nuxt SEO

-
-
-
-

[1.4K](https://github.com/harlan-zw/nuxt-seo)

[Nuxt SEO on GitHub](https://github.com/harlan-zw/nuxt-seo)

**OG Image v6** is here! Looking for an older version?

.

OG Image

-
-
-
-
-
-
-
-
-
-

Search…```k`` /`

v6 (latest)

- Playgrounds
- [Discord Support](https://discord.com/invite/275MBUBvgP)

### Getting Started

-
-
-
-

### Core Concepts

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

### Overview

-
-
-
-

### Integrations

-
-
-

Core Concepts

# Route Rules

[Copy for LLMs](https://nuxtseo.com/docs/og-image/guides/route-rules.md)

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.

nuxt.config.ts

```
export default defineNuxtConfig({
  routeRules: {
    '/og-image/**': {
      ogImage: {
        props: { icon: 'carbon:image-search' }
      }
    }
  }
})
```

## [Wildcard Route Rules Warning](#wildcard-route-rules-warning)

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

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:

nuxt.config.ts

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

[Edit this page](https://github.com/nuxt-modules/og-image/edit/main/docs/content/3.guides/2.route-rules.md)

[Markdown For LLMs](https://nuxtseo.com/docs/og-image/guides/route-rules.md)

Did this page help you?

[GitHub](https://github.com/harlan-zw/nuxt-seo) [ Discord](https://discord.com/invite/275MBUBvgP)

###

-
-

Modules

-
-
-
-
-
-
-
-
-

###

-
-
-

###

Nuxt

-
-
-
-
-

Vue

-
-
-
-
-
-
-
-

###

-
-
-
-
-
-
-
-
-
-

Copyright © 2023-2026 Harlan Wilton - [MIT License](https://github.com/harlan-zw/nuxt-seo/blob/main/license) · [mdream](https://mdream.dev)