Metatag classname
Answered
Blanc de Hotot posted this in #help-forum
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(
<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
7 Replies
@Blanc de Hotot 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(
try this
export const metadata = {
other: {
"FIELD_NAME_1": "FIELD_VALUE_1"
}
}@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
@Ray oh what is the class for?
Blanc de HototOP
https://www.elastic.co/guide/en/app-search/current/web-crawler-reference.html#web-crawler-reference-meta-tags-content-extraction for elastic search. it can read metadata with class="elastic"
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