react-helmet-async
react-helmet-async copied to clipboard
Duplicate description meta tag
Hello there. I have default meta-tag description at the index.html React-helmet can replace meta-tag description at the index.html, but not react-helmet-async
Now i have two meta-tag description: from index.html and from another page.
Usage:
index.html
<meta name="description" content="My awesome description" data-react-helmet="true" />
anotherPage.js
<Helmet defer={false} titleTemplate="%s - My site" defaultTitle=My default title">
<title>Title for page</title>
- work fine
<meta name="description" content="Another description" data-react-helmet="true" />
- not working...
But if i remove description tag from index.html, i don't see any description tag.
Remove data-react-helmet="true"
didn't help.
P.s sorry for my English :)
A late solution here, in case anyone encounters the same problem: for react-helmet-async, the attribute to set is data-rh="true"
instead of data-react-helmet="true"
. It should really be documented, though 🤔
@antoinegaillardpaloit thank you. I came across this issue today + this saved me some time!
As @antoinegaillardpaloit said, using data-rh="true"
on static meta tags work, but I noticed some important behavior to mention:
- Suppose you have this hardcoded meta in your HTML template:
<meta name="xyz" content="ABC" data-rh="true"/>
- Now you render a React app but don't render this:
<Helmet><meta name="xyz" content="ABC" data-rh="true"/></Helmet>
- Your SSR output will contain the
xyz
metadata -
After hydration, the
xyz
metadata will be erased by Helmet
- Suppose you have this hardcoded meta in your HTML template:
<meta name="xyz" content="ABC" data-rh="true"/>
add data-rh="true"
to tags not rendered by Helmet probably voids your warranty
I have tried these solution but still when I share a link to specific page of my site I get the meta tags that are defined in the index.html file. I am using CSR.
I have a React project where the metadata is changing. But when I share my URL with someone, their title and description don't update. I have separate metadata for each page.
I have a React project where the metadata is changing. But when I share my URL with someone, their title and description don't update. I have separate metadata for each page.
I am facing similar issue.
I have a React project where the metadata is changing. But when I share my URL with someone, their title and description don't update. I have separate metadata for each page.
I am facing similar issue.
Suggestions are to use NextJs SSR (Server Side Renderering) and also to use a separate system for this to preload pages. This is the article I am following to resolve this https://ravikirandhulipala.medium.com/how-to-resolve-meta-data-issues-in-react-spa-with-server-side-rendering-firebase-cloud-functions-7e5549690820
I have a React project where the metadata is changing. But when I share my URL with someone, their title and description don't update. I have separate metadata for each page.
I am facing similar issue.
Suggestions are to use NextJs SSR (Server Side Renderering) and also to use a separate system for this to preload pages.
This is the article I am following to resolve this https://ravikirandhulipala.medium.com/how-to-resolve-meta-data-issues-in-react-spa-with-server-side-rendering-firebase-cloud-functions-7e5549690820
But I can't use SSR @heyalizaid