nfl / react-helmet

A document head manager for React
MIT License
17.28k stars 657 forks source link

DOCTYPE has to be removed to allow bots to see CRA meta tags #636

Closed Brydom closed 8 months ago

Brydom commented 3 years ago

Do you want to request a feature or report a bug?

What is the current behavior?

Steps to reproduce are tricky, and unsure if it'll be possible, but worth a shot—we have a large (and new) application using create-react-app.

If <!DOCTYPE html> is included in index.html the build + locally served application does not have the correct meta tags for a bot—but are visible in the inspector.

If it is not included, the build + locally served application has the correct meta tags on render and is visible.

I am using a chrome extension to read the tags on the served page. (https://chrome.google.com/webstore/detail/meta-tag-analyzer/fjaojohahonilkanpijpfhkekbegbkfa)

This may not be a react-helmet issue as I have seen removing doctype as a temporary solution mostly in Netlify (although we aren't using that) but I thought I'd post the issue and see if anyone is facing something similar.

What is the expected behavior?

Which versions of React and react-helmet, and which browser / OS are affected by this issue? Did this work in previous versions of React and/or react-helmet? Latest Chrome react-helmet: 6.1.0 react: 17.0.1