Next.js Discord

Discord Forum

Metatag classname

Answered
Blanc de Hotot posted this in #help-forum
Open in Discord
Blanc de HototOP
I need to add metatags with class name (for Elastic) Example is

<meta class="elastic" name="{FIELD_NAME_1}" content="{FIELD_VALUE_1}">
By default they are adding without any class and there is no way to add it.

I didnt find anything how to do it in Next documentation so could someone tells me what the correct way to do that?

UPD: its server component and it should be server component, i cant change it to client

UPD2: I need add class="elastic" for some metatags.

UPD3: Maybe there is a way to modify existing metatags in head in server component? getElementsByTagName not working there(
Answered by Blanc de Hotot
....... solution. if i add any metatag to component its automaticly move to head.... is that correct behavior ? @Ray
View full answer

7 Replies

@Ray try this ts export const metadata = { other: { "FIELD_NAME_1": "FIELD_VALUE_1" } }
Blanc de HototOP
yeah i know) it woorks but i need class attribute)
class="elastic" is required for my question) i can add any metatag but without custom attributes
Blanc de HototOP
....... solution. if i add any metatag to component its automaticly move to head.... is that correct behavior ? @Ray
Answer
@Blanc de Hotot ....... solution. if i add any metatag to component its automaticly move to head.... is that correct behavior ? <@743561772069421169>
oh Im not sure as I have never tried that. But I would recommond you use some tools online to check the SEO for your site