Skip to content
A react SEO component
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.babelrc
.gitignore
README.md
index.js
package.json
renovate.json
rollup.config.js
yarn.lock

README.md

A react-seo-component

CodeFactor

Use it for adding canonical links, metadata and OpenGraph information to your react projects!

Use it!

Install it from npm!

yarn add react-seo-component

If you are using it with Gatsby you will need to install gatsby-plugin-react-helmet to have the meta tags generated at build time.

Examples:

For an index page:

<SEO
  title={title}
  description={description || 'nothin’'}
  image={image}
  pathname={siteUrl}
  siteLanguage={siteLanguage}
  siteLocale={siteLocale}
  twitterUsername={twitterUsername}
/>

For a blog post:

<SEO
  title={title}
  description={description}
  image={image}
  pathname={siteUrlPlusSlug}
  siteLanguage={siteLanguage}
  siteLocale={siteLocale}
  twitterUsername={twitterUsername}
  author={authorName}
  article={true}
  publishedDate={createdDate}
  modifiedDate={updatedDate}
/>

Dependencies

Presumes you already have the following installed:

  • prop-types
  • react
  • react-helmet

Props

Prop Type Default
title Site title ''
description Page description ''
pathname Full Page URL ''
article article or website website
image Full image URL ''
siteLanguage Content Language en
siteLocale Content Locale en_gb
twitterUsername can be empty ''
author can not empty 'J Doe'
datePublished ISO date string Date.now()
dateModified ISO date string Date.now()

Thanks

Thanks to @LekoArts for the initial components detailed in his Gatsby Prismic starter.

Resources

https://medium.com/recraftrelic/building-a-react-component-as-a-npm-module-18308d4ccde9

https://github.com/recraftrelic/dummy-react-npm-module/blob/master/package.json

You can’t perform that action at this time.