Skip to content
← Projects

Open sourceLive2026.01.06 ~v1.11.2 · 3,093 downloads in the past year

react-head-safe

A library that manages the document head in client-rendered React so meta tags don't pile up as duplicates.

About

It overwrites the default tags in index.html with per-page tags, so crawlers read the right values whether or not they run JS.
I generalized and open-sourced a component I built at work to fix duplicate meta tags.

Features

  • Configure with propsPass title, description, and og values to ReactHeadSafe and they land in the head.
  • Removes duplicate tagsClears existing meta tags before inserting new ones, so they don't clash with the defaults.
  • Automatic Twitter CardsWrites twitter tags and twitter:card from your og values.
  • Cleanup on unmountWhen you leave a page, the meta and link tags that instance added are removed.
  • canonical · robotsSet the canonical URL and whether the page should be indexed.
  • React 17 · 18 · 19No dependencies besides React, and the same API works across all three versions.

Tech stack

  • React
  • TypeScript
  • Vite
  • Vitest