Source plugin for pulling data into Gatsby from RSS feed.
npm install --save gatsby-source-rss-feedor
yarn add gatsby-source-rss-feed// In your gatsby-config.js
module.exports = {
plugins: [
{
resolve: `gatsby-source-rss-feed`,
options: {
url: `http://static.userland.com/gems/backend/rssTwoExample2.xml`,
name: `ExampleRSS`,
}
}
]
}// In your gatsby-config.js
module.exports = {
plugins: [
{
resolve: `gatsby-source-rss-feed`,
options: {
url: `http://static.userland.com/gems/backend/rssTwoExample2.xml`,
name: `ExampleRSS`,
}
}
{
resolve: `gatsby-source-rss-feed`,
options: {
url: `http://static.userland.com/gems/backend/rssTwoExample2.xml`,
name: `MyBlog`,
}
}
]
}This library use rss-parser.
You can pass options via parserOptions.
// In your gatsby-config.js
module.exports = {
plugins: [
{
resolve: `gatsby-source-rss-feed`,
options: {
url: `http://static.userland.com/gems/backend/rssTwoExample2.xml`,
name: `ExampleRSS`,
// Optional
// Read parser document: https://github.com/bobby-brennan/rss-parser#readme
parserOption: {
customFields: {
item: ['itunes:duration']
}
}
}
}
]
}Query is Feed${name}.
When name of options is ExampleRSS, query named as FeedExampleRSS.
{
allFeedExampleRSS {
edges {
node {
title
link
content
}
}
}
feedExampleRSS {
title
link
content
}
}Data not part of the items can be accessed with Feed${name}Meta
When name of options is ExampleRSS, query named as FeedExampleRSSMeta.
{
feedExampleRSSMeta {
title
author
description
lastBuiltDate
}
}