Best Practice Default Meta
Introduction
To ensure your site is SEO friendly, Nuxt SEO sets some default meta tags for you based on your site config.
Canonical URL
Ensuring a canonical URL is set helps avoid duplicate content issues.
This can be an issue when you have multiple domains or subdomains pointing to the same content, trailing slashes and non-trailing slashes showing the same content and when you have query parameters that don't change the content.
Learn more about canonical URLs with the Canonical Link Tag guide.
The canonical URL is generated from your site config url, the current route and the canonicalQueryWhitelist.
canonicalQueryWhitelist: by default, it includes a number of common query parameters that will modify the page content:
pagesortfiltersearchqcategorytag
You can override this by providing your own list of query parameters that should be included in the canonical URL.
export default defineNuxtConfig({
seo: {
canonicalQueryWhitelist: ['myCustomQuery']
}
})I18n
Google wants you to list the language that any given page is written in as <html lang="<locale>">.
Nuxt SEO will set this for you based on your site config currentLocale and defaultLocale (default en).
If you're using the @nuxtjs/i18n module, then this is automatically set for you.
lang attribute.Open Graph
Providing extra open-graph meta tags helps social media platforms understand your content better.
The following tags are set:
og:url- The canonical URL of the page.og:type- Set to'website'.og:locale- The current locale of the page based on site configcurrentLocaleanddefaultLocale. Only set when the locale includes a region code (e.g.en_US), not for simple locales likeen.og:site_name- The name of your site based on site configname.
Server-only crawler defaults
Enable seo.serverOnlyCrawlerDefaults to reduce the client bundle. The option
applies only to production builds with SSR enabled, including prerendered pages.
It is off by default.
export default defineNuxtConfig({
seo: {
serverOnlyCrawlerDefaults: true,
},
})Nuxt SEO Utils keeps generated descriptions, canonical links, and social tags in
the server HTML. This includes social images from public/ and page directories.
The browser applies title templates, document language, and app.head metadata
such as icons.
A social image set in routeRules can override a generated image from a page
directory.
After client navigation, generated crawler tags can still describe the first page you loaded. Leave the option off if client-only routes need these defaults or if the defaults need to update during client navigation.
Disable Default Meta
While all default meta is registered with low priority, allowing you to easily override them, you may want to disable them entirely.
export default defineNuxtConfig({
seo: {
automaticDefaults: false
}
})