Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure "data-react-helmet" always renders its value as "true" #658

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

asilgag
Copy link

@asilgag asilgag commented Oct 6, 2021

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 in generateTitleAsReactComponent() and generateTagsAsReactComponent(), where it's value is a boolean (true).

This subtle inconsistency has no effect in most cases, except when using Preact + preact-compat:

  • React renders a boolean value as data-react-helmet="true" (it might change in the future)
  • Preact renders a boolean value as 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.

@CLAassistant
Copy link

CLAassistant commented Oct 6, 2021

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants