Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react helmet not showing meta tags in view page source but shows in element on inspect

We have this web and we added meta tags in different pages using this way .

     <Helmet>
            <title>THIS IS TITLE</title>
            <meta
            name="description" 
            content="THIS IS CONTENT" />
        </Helmet>

I see the change in title when i hit the route for this page .I see meta tags in elements but i don't see meta tags of that page in view page source .What's wrong and how can we solve this .As per our seo expert ,it should come in view page source .Note:It is a client side rendered app .

like image 490
horrible_nerd Avatar asked Feb 29 '20 16:02

horrible_nerd


1 Answers

This is because react (and react-helmet) are front-end tools (unless you are doing server side rendering) and the view source browser's feature is showing you the original source downloaded from the server, while the "inspect" action is displaying the actual DOM.

What this means?

Your users will see new meta tags normally, and so Google Bot (as recently started to execute JavaScript) but not other crawling service or search engines.

If you want to target other search engines: do SSR.

like image 81
keul Avatar answered Nov 07 '22 03:11

keul