Skip to content

Support single objects for meta prop #220

Closed
@joshwcomeau

Description

While passing meta values to <Helmet>, the provided API is an array of objects:

<Helmet
  meta={[
    { name: "description", content: "Helmet application" },
    { property: "og:type", content: "article" },
  ]}
/>

A co-worker recently tried passing a single object instead:

<Helmet
  meta={{ name: "description", content: "Helmet application" }}
/>

The consequences of this were rather severe; because we render on the server, React Helmet's exception crashed a server crash. A careless deploy meant we spent quite a long time trying to figure out why our server kept going down.

Please understand that we accept responsibility for this, it was totally our fault for misunderstanding the documentation :)

That said, it could be helpful to prevent similar mistakes by other users to support the 'single object' syntax, for when only a single meta property needs to be set.

Would be happy to look into this and open a PR, if it's deemed a worthwhile inclusion!

Thanks.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions