gatsby-plugin-readingtime-contentful

1.0.0 • Public • Published

gatsby-plugin-readingtime-contentful

Adds a medium-like reading time estimate to your Gatsby Contentful content. Powered by reading-time.

Installation

Install

yarn add gatsby-plugin-readingtime-contentful
// gatsby-config.js
  ...
  plugins: [
    'gatsby-plugin-readingtime-contentful',
     ...
  ],

Usage

Example query

Where content is a rich text field.

export const query = graphql`
query MagazineArticles {
  allContentfulArticle{
    edges {
      node {
        title
        locale: node_locale
        createdAt
        content {
          json
          fields {
            readingTime {
              text
              minutes
              time
              words
            }
          }
        }
      }
    }
  }
}

`;

Fields

There are 4 available fields within readingTime:

  • text: '1 min read',
  • minutes: 1,
  • time: 60000, (milliseconds)
  • words: 200

Package Sidebar

Install

npm i gatsby-plugin-readingtime-contentful

Weekly Downloads

34

Version

1.0.0

License

MIT

Unpacked Size

65.5 kB

Total Files

8

Last publish

Collaborators

  • nbaosullivan