Nuxt 3 provides several different ways to manage your meta tags:
nuxt.config.useHead composableYou can customize title, titleTemplate, base, script, noscript, style, meta, link, htmlAttrs and bodyAttrs.
Nuxt currently uses vueuse/head to manage your meta tags, but implementation details may change.
nuxt.config, rename head to meta. Consider moving this shared meta configuration into your app.vue instead. (Note that objects no longer have a hid key for deduplication.)head, you should migrate to using useHead . You might also consider using the built-in meta-components.head() method you can use when you use defineNuxtComponent.<script>
export default {
data: () => ({
title: 'My App',
description: 'My App Description'
})
head () {
return {
title: this.title,
meta: [{
hid: 'description',
name: 'description',
content: this.description
}]
}
}
}
</script>
Nuxt 3 also provides meta components that you can use to accomplish the same task. While these components look similar to HTML tags, they are provided by Nuxt and have similar functionality.
<script>
export default {
head () {
return {
title: 'My App',
meta: [{
hid: 'description',
name: 'description',
content: 'My App Description'
}]
}
}
}
</script>
<Title> rather than <title>).<script>
// if using options API `head` method you must use `defineNuxtComponent`
export default defineNuxtComponent({
head (nuxtApp) {
// `head` receives the nuxt app but cannot access the component instance
return {
meta: [{
name: 'description',
content: 'This is my page description.'
}]
}
}
})
</script>
[
{
"title": "Auto Imports",
"path": "/nuxt/migration/auto-imports",
"stem": "nuxt/7.migration/3.auto-imports",
"description": "Nuxt 3 adopts a minimal friction approach, meaning wherever possible components and composables are auto-imported."
},
{
"title": "Plugins and Middleware",
"path": "/nuxt/migration/plugins-and-middleware",
"stem": "nuxt/7.migration/5.plugins-and-middleware",
"description": "Learn how to migrate from Nuxt 2 to Nuxt 3 plugins and middleware."
}
]