Ensure "data-react-helmet" always renders its value as "true" #658
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The value of "data-react-helmet" attribute is set several times and in several contexts across react-helmet. In all cases is set as a string (
"true"
), except ingenerateTitleAsReactComponent()
andgenerateTagsAsReactComponent()
, where it's value is a boolean (true
).This subtle inconsistency has no effect in most cases, except when using Preact + preact-compat:
data-react-helmet="true"
(it might change in the future)data-react-helmet
(it might change in the future)Both are valid syntax, but I have encountered that some social media scrappers (like Whatsapp) do not understand a meta tag if it contains an empty data attribute. Hence,
<meta data-react-helmet property="og:title" content="My title" />
is considered incorrect and thus not parsed.We should ensure the consistency of values for that data attribute, to ensure it's always rendered the same way, regardless the fact of using React of Preact. At this moment, it's relaying on React's interpretation of boolean values, that could be changed in the future, which could lead to unexpected results.