JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 90
  • Score
    100M100P100Q93981F
  • License MIT

A react SEO component

Package Exports

  • react-seo-component

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-seo-component) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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

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}
  article={true}
  publishedDate={createdDate}
  modifiedDate={updatedDate}
/>

Dependencies

Presumes you already have the following installed:

  • prop-types
  • react
  • react-helmet

Props

Prop Use Default
title Site title ''
description Page description ''
pathname Page URL ''
article article or website website
image image ''
siteLanguage en
siteLocale 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