Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gatsby-plugin-react-helmet

Package Overview
Dependencies
Maintainers
7
Versions
391
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-plugin-react-helmet

Manage document head data with react-helmet. Provides drop-in server rendering support for Gatsby.

  • 6.14.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
152K
decreased by-1.34%
Maintainers
7
Weekly downloads
 
Created

What is gatsby-plugin-react-helmet?

The gatsby-plugin-react-helmet package is a Gatsby plugin that integrates React Helmet into your Gatsby site. React Helmet is a library that allows you to manage changes to the document head, such as the title, meta tags, and other elements, from within your React components.

What are gatsby-plugin-react-helmet's main functionalities?

Setting the Page Title

This feature allows you to set the title of the page dynamically from within a React component. The title tag is updated in the document head when the component is rendered.


import React from 'react';
import { Helmet } from 'react-helmet';

const MyComponent = () => (
  <div>
    <Helmet>
      <title>My Page Title</title>
    </Helmet>
    <h1>Hello, world!</h1>
  </div>
);

export default MyComponent;

Adding Meta Tags

This feature allows you to add meta tags to the document head. You can specify various meta tags such as charset, description, keywords, etc., directly within your React components.


import React from 'react';
import { Helmet } from 'react-helmet';

const MyComponent = () => (
  <div>
    <Helmet>
      <meta charSet="utf-8" />
      <meta name="description" content="This is a description of my page" />
    </Helmet>
    <h1>Hello, world!</h1>
  </div>
);

export default MyComponent;

Link Tags

This feature allows you to add link tags to the document head. This is useful for things like setting the canonical URL of the page, adding stylesheets, or preloading resources.


import React from 'react';
import { Helmet } from 'react-helmet';

const MyComponent = () => (
  <div>
    <Helmet>
      <link rel="canonical" href="https://www.example.com/my-page" />
    </Helmet>
    <h1>Hello, world!</h1>
  </div>
);

export default MyComponent;

Other packages similar to gatsby-plugin-react-helmet

Keywords

FAQs

Package last updated on 06 Nov 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc