SEO Route Rules
Introduction
Sometimes we're dealing with complex page structures which make it difficult to set SEO meta tags appropriately without duplication.
To get around this, you can use build-time Route Rules to set dynamic SEO meta tags. This is useful for setting up default meta tags for a specific set of pages, such as a blog or product pages.
Usage
Route rules are injected server-side and won't update on client-side navigation. Only use for crawler-facing data.
Trying to set default OG Images? Try instead use the App Icons - Open Graph Images.
seoMeta
Takes the same input as useSeoMeta().
Nuxt SEO Utils loads the Infer SEO Meta Plugin from Unhead that will automatically infer SEO meta tags for you based on your content, including
og:title, og:description, twitter:card.export default defineNuxtConfig({
routeRules: {
'/blog/**': {
seoMeta: {
author: 'Harlan Wilton',
},
},
}
})head
Takes the same input as useHead().
export default defineNuxtConfig({
routeRules: {
'/blog/**': {
head: {
// set default icon for blog posts
link: [
{ rel: 'icon', type: 'image/png', href: '/blog-icon.png' }
]
},
},
}
})Precedence: route rule head and seoMeta render at the default priority.
They override app.head, seo.meta, and the module defaults for the matched routes.
A page-level useSeoMeta() or useHead() call overrides them.
Was this page helpful?