You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP

react-helmet

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-helmet

A document head manager for React

6.1.0
latest
Version published
Weekly downloads
2.1M
0.88%
Maintainers
5
Weekly downloads
 
Created

What is react-helmet?

The react-helmet npm package is a reusable React component that manages all changes to the document head. It allows developers to dynamically set what's in the head section of the HTML document, including the title, meta tags, and other head elements, which is particularly useful for handling SEO in React applications.

What are react-helmet's main functionalities?

Managing the document title

This feature allows you to set the content of the <title> tag in the document head, which is displayed as the title of the tab in web browsers.

{"<Helmet>\n  <title>My Title</title>\n</Helmet>"}

Setting meta tags

With this feature, you can dynamically set various meta tags for your page, which can be used by search engines and social media platforms for SEO and content sharing purposes.

{"<Helmet>\n  <meta name='description' content='Page description' />\n  <meta name='keywords' content='React, SEO' />\n</Helmet>"}

Adding link tags

This feature allows you to include link elements in the head of the document, such as canonical links, stylesheets, or preconnect URLs.

{"<Helmet>\n  <link rel='canonical' href='http://mysite.com/example' />\n</Helmet>"}

Adding script tags

This feature enables you to insert script tags into the head of the document, which can be used to include external JavaScript files or inline scripts.

{"<Helmet>\n  <script src='http://include.com/pathtojs.js' type='text/javascript' />\n</Helmet>"}

Setting HTML attributes

This feature allows you to set attributes on the <html> tag, such as the language of the document.

{"<Helmet>\n  <html lang='en' />\n</Helmet>"}

Setting body attributes

With this feature, you can set attributes on the <body> tag, such as class names or data attributes.

{"<Helmet>\n  <body class='dark-mode' />\n</Helmet>"}

Other packages similar to react-helmet

FAQs

Package last updated on 08 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts