Route Rules

Learn how to use route rules to customise your OG Image.

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' }
      }
    }
  }
})
Did this page help you?