---
title: "Route Rules · Nuxt OG Image · Nuxt SEO"
canonical_url: "https://nuxtseo.com/docs/og-image/guides/route-rules"
last_updated: "2026-08-16T09:55:34.184Z"
meta:
  description: "Learn how to use route rules to customize your OG Image."
  "og:description": "Learn how to use route rules to customize your OG Image."
  "og:title": "Route Rules · Nuxt OG Image · Nuxt SEO"
---

Nuxt SEO on GitHub

**OG Image v6** is here. Looking for an older version? [~~View v5 docs ~~](https://nuxtseo.com/docs/og-image/v5/getting-started/introduction).

](https://nuxtseo.com/docs/og-image/getting-started/introduction)

](https://nuxtseo.com/docs/og-image/api/define-og-image)

](https://nuxtseo.com/docs/og-image/releases/v6)

Switch to OG Image](https://nuxtseo.com/docs/og-image/getting-started/introduction)Switch to Nuxt SEO](https://nuxtseo.com/docs/nuxt-seo/getting-started/introduction)Switch to Robots](https://nuxtseo.com/docs/robots/getting-started/introduction)Switch to Sitemap](https://nuxtseo.com/docs/sitemap/getting-started/introduction)Switch to Schema.org](https://nuxtseo.com/docs/schema-org/getting-started/introduction)Switch to Link Checker](https://nuxtseo.com/docs/link-checker/getting-started/introduction)Switch to SEO Utils](https://nuxtseo.com/docs/seo-utils/getting-started/introduction)Switch to Site Config](https://nuxtseo.com/docs/site-config/getting-started/introduction)Switch to Skew Protection](https://nuxtseo.com/docs/skew-protection/getting-started/introduction)Switch to AI Ready](https://nuxtseo.com/docs/ai-ready/getting-started/introduction)

**Core Concepts**

# **Route Rules**

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

You can handle this even more easily with route rule merging.

This lets you provide an `**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

```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.

nuxt.config.ts

```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

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

**Was this page helpful?**

### **Related **

[**Embedding OG Images**](https://nuxtseo.com/docs/og-image/guides/resolve-og-images)

[**Nuxt Config**](https://nuxtseo.com/docs/og-image/api/config)

[**Config Using Route Rules**](https://nuxtseo.com/docs/robots/guides/route-rules)

[**Cloudflare** Deploy Nuxt OG Image to Cloudflare Workers or Pages.](https://nuxtseo.com/docs/og-image/guides/cloudflare) [**Embedding OG Images** Render another page's OG image in an \<img> tag without reconstructing its URL.](https://nuxtseo.com/docs/og-image/guides/resolve-og-images)