Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mottox2/gatsby-source-rss-feed
Gatsby source plugin for rss feed.
https://github.com/mottox2/gatsby-source-rss-feed
gatsby-plugin gatsby-source-plugin gatsbyjs
Last synced: 3 months ago
JSON representation
Gatsby source plugin for rss feed.
- Host: GitHub
- URL: https://github.com/mottox2/gatsby-source-rss-feed
- Owner: mottox2
- Created: 2019-01-08T07:48:19.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T01:51:47.000Z (almost 2 years ago)
- Last Synced: 2024-10-01T07:08:26.034Z (3 months ago)
- Topics: gatsby-plugin, gatsby-source-plugin, gatsbyjs
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/gatsby-source-rss-feed
- Size: 258 KB
- Stars: 24
- Watchers: 3
- Forks: 6
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gatsby-source-rss-feed
[![npm version](https://badge.fury.io/js/gatsby-source-rss-feed.svg)](https://badge.fury.io/js/gatsby-source-rss-feed)
Source plugin for pulling data into Gatsby from RSS feed.
## Install
```bash
npm install --save gatsby-source-rss-feed
```or
```bash
yarn add gatsby-source-rss-feed
```## How to use
### basic pattern
```js
// 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`,
}
}
]
}
```### use multiple feed
```js
// 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`,
}
}
]
}
```### with parserOption
This library use [rss-parser](https://github.com/bobby-brennan/rss-parser#readme).
You can pass options via parserOptions.
```js
// 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']
}
}
}
}
]
}
```## How to query
Query is `Feed${name}`.
When name of options is `ExampleRSS`, query named as `FeedExampleRSS`.
```graphql
{
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`.
```graphql
{
feedExampleRSSMeta {
title
author
description
lastBuiltDate
}
}
```