Nazmul Hasan
Nazmul Hasan

Reputation: 87

React <Helmet> is not updating the meta

I have created a react app with around 10 components. I have added meta tag using Helmet. But when I inspect source from browser, but meta tag shows some random imdb the rock type thing.
Any suggestions will be appreciated.

<Helmet>
   <meta charSet="utf-8" />
   <title>My Title</title>
   <link name="description" content="some test description" />
</Helmet>

Upvotes: 2

Views: 873

Answers (1)

glinda93
glinda93

Reputation: 8479

You cannot inspect meta tags from html source, because:

  • html source is static content that javascript cannot touch
  • helmet will create meta tags for you after react javascript has been executed

If you want to check meta tags:

  • Use "Element" tab in developer tool instead of inspect source
  • Use console to check if meta tags exists:

For example, open developer console and you can find link tag as follows:

document.querySelector("link[name=description]");

Upvotes: 0

Related Questions