# react-helmet **Repository Path**: mirrors_gaearon/react-helmet ## Basic Information - **Project Name**: react-helmet - **Description**: Specify the page title, meta & link tags per component in a nested fashion - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-08 - **Last Updated**: 2026-07-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # React Helmet [![npm package](https://img.shields.io/npm/v/react-helmet.svg?style=flat-square)](https://www.npmjs.org/package/react-helmet) [![build status](https://img.shields.io/travis/nfl/react-helmet/master.svg?style=flat-square)](https://travis-ci.org/nfl/react-helmet) [![dependency status](https://img.shields.io/david/nfl/react-helmet.svg?style=flat-square)](https://david-dm.org/nfl/react-helmet) This reusable React component will manage all of your changes to the document head with support for document title, meta & link tags. Inspired by [react-document-title](https://github.com/gaearon/react-document-title) **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - [Examples](#examples) - [Features](#features) - [Installation](#installation) - [Server Usage](#server-usage) - [Use Cases](#use-cases) - [Contributing to this project](#contributing-to-this-project) - [License](#license) ## Examples ```javascript import React from "react"; import Helmet from "react-helmet"; export default class Application extends React.Component { render() { return (
...
); } }; ``` ```javascript import React from "react"; import Helmet from "react-helmet"; export default class Application extends React.Component { render() { return (
...
); } }; ``` ## Features - Supports isomorphic environment. - Nested components override duplicate head changes. - Duplicate head changes preserved when specified in same component (support for tags like "apple-touch-icon"). - Only valid `meta`/`link` key names allowed. ## Installation ``` npm install --save react-helmet ``` ## Server Usage To use on the server, call `rewind()` after `React.renderToString` to get all the head changes to use in your prerender. ```javascript React.renderToString(); let head = Helmet.rewind(); head.title head.meta head.link ``` **Note:** Because this component tracks mounted instances you will need to call rewind on the server to avoid a memory leak. ## Use Cases 1. Nested or latter components will override duplicate changes. ```javascript ``` Yields: ``` Nested Title ``` 2. Use a titleTemplate to format title text in your page title ```javascript ``` Yields: ``` Nested Title | MyAwesomeWebsite.com ``` 3. Duplicate `meta` and/or `link` tags in the same component are preserved ```javascript ``` Yields: ``` ``` 4. Duplicate tags can still be overwritten ```javascript ``` Yields: ``` ``` ## Contributing to this project Please take a moment to review the [guidelines for contributing](CONTRIBUTING.md). * [Pull requests](CONTRIBUTING.md#pull-requests) * [Development Process](CONTRIBUTING.md#development) ## License MIT