I have a nuxt project, where the meta title and description comes (from nuxt/content). The async fetch for the data is made in index and received in a sub component via a getter.
On generate, the meta tags are there but on ssr not :/
I tried it with async and await, but I still get the error
Uncaught (in promise) TypeError: seoTitle is undefined
(I tried it with a useless await this.getArticle const, in hope that the whole thing waits, this stuff is there, but no)
Here my code:
async head() {
const article = await this.getArticle
const seoTitle = await this.getArticle.seoTitle,
title = await this.getArticle.title,
seoDescription = await this.getArticle.description
return {
title: `"${
seoTitle.length ? seoTitle : title
}"`,
meta: [
{
hid: "description",
name: "description",
content: `${
seoDescription.length
? seoDescription.slice(0, 50)
: seoDescription.slice(0, 50)
}`,
},
],
};
},
On generate, the meta tags are there but on ssr not. You do havetarget: staticandssr: true, right? How can they be there on generate?ssr: trueis the default and withtarget: static, you should be good. Does it work when you'reyarn generate+yarn start, do you see your meta?