Next.js Discord

Discord Forum

Render meta tags with empty content

Answered
nevz posted this in #help-forum
Open in Discord
Avatar
Is there a way to render the meta tag when the value is an empty string? It does not render anything if the field is empty e.g.
export function generateMetadata() {
 return { title: 'Shows up', description: '' }
}

meta tag for description here will not render here because it's an empty string, I'm expecting to just have an empty content like <meta content="" name="description">

Asked in gpt-help the solution was to add a whitespace, but not sure why can't we just render with an empty string for content
Answered by Jesse677
What's the point of having a description if it's gonna be blank
View full answer

5 Replies

Avatar
What's the point of having a description if it's gonna be blank
Answer
Avatar
You should have one if you want good SEO
@nevz
Avatar
well it's not really going to be hard coded, but just wondering if there's a workaround, but you definitely gave a good point, I remember some site audits showing warnings for empty content, but still it makes sense to me to just render the tag
Avatar
thanks anyway, since I tested just adding it in JSX doesn't really solve it