Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

ContactSign Up
Community Plugin
View plugin on GitHub

gatsby-source-rss-feed

npm version

Source plugin for pulling data into Gatsby from RSS feed.

Install

npm install --save gatsby-source-rss-feed

or

yarn add gatsby-source-rss-feed

How to use

// In your gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: `gatsby-source-rss-feed`,
      options: {
        url: `https://www.gatsbyjs.org/blog/rss.xml`,
        name: `GatsbyBlog`,
        // Optional
        // Read parser document: https://github.com/bobby-brennan/rss-parser#readme
        parserOption: {
          customFields: {
            item: ['itunes:duration']
          }
        }
      }
    }
  ]
}

How to query

Query is Feed${name}.

When name of options is GatsbyBlog, query named as FeedGatsbyBlog.

{
  allFeedGatsbyBlog {
    edges {
      node {
        title
        link
        content
      }
    }
  }

  feedGatsbyBlog {
    title
    link
    content
  }
}

Data not part of the items can be accessed with Feed${name}Meta

When name of options is GatsbyBlog, query named as FeedGatsbyBlogMeta.

{
  feedGatsbyBlogMeta {
    title
    author
    description
    lastBuiltDate
  }
}
© 2024 Gatsby, Inc.