Skip to content

Commit

Permalink
📝 update: README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Girgetto committed Jun 30, 2021
1 parent f396a36 commit 4d5ef7e
Showing 1 changed file with 57 additions and 1 deletion.
58 changes: 57 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ Add RSS feed into your Gatsby site.
```
npm i gatsby-plugin-parse-rss
```

or

```
yarn add gatsby-plugin-parse-rss
```
## Example

## How to Use

Add the plugin in your `gatsby-config.js`

```js
plugins: [
Expand All @@ -35,3 +40,54 @@ plugins: [
},
];
```

## Options

In the `options` property you'll need to add an object with a property `rss` which is an array of objects with the RSS informations you want to parse

```js
{
urlToFetch: "URL_TO_FETCH",
selectors: ["SELECTORS"],
name: "graphQLPropertyName",
}
```

Use gatsby's `useStaticQuery` to retrieve datas

```graphql
{
allYouTubeRss {
nodes {
media_title
media_thumbnail
}
}
}
```

This is how the data is retrieved

```json
{
"data": {
"allYouTubeRss": {
"nodes": [
{
"media_title": [
"React JS | To Do List | Speed Coding",
"React JS | Calculator | Speed Coding"
],
"media_thumbnail": [
"https://i1.ytimg.com/vi/PDJKXpEtIuA/hqdefault.jpg",
"https://i4.ytimg.com/vi/OPfaCowjGMc/hqdefault.jpg"
]
}
]
}
},
"extensions": {}
}
```

## Example: [CodeSandbox](https://codesandbox.io/s/gatsby-plugin-parse-rss-4pd1y)

0 comments on commit 4d5ef7e

Please sign in to comment.