Reputation: 51
I try to customize the default page from Nuxt app but the documentation is very poor :
What if i want to get only the title for example ? or only the links in the head ?
{{ HEAD.links }}
or only the meta ?
{{ HEAD.meta }}
I don't know the syntax, is this handlebars or something equivalent ?
Thank you !
Upvotes: 3
Views: 9112
Reputation: 7631
if you look in the source code, you can found only 4 custom meta:
the HEAD meta is not an object, but an string concat:
// Get vue-meta context
const m = await this.getMeta(url)
...
// HEAD tags
meta.HEAD =
m.meta.text() +
m.title.text() +
m.link.text() +
m.style.text() +
m.script.text() +
m.noscript.text()
so you cannot get {{ HEAD.links }}
But, from your nuxt.config.js
file, you can override all that HEAD data.
eg. if you want only keep the title
:
replace:
head: {
title: 'starter',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: 'Nuxt.js project' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
}
by:
head: {
title: 'starter'
},
Upvotes: 2