Socket
Socket
Sign inDemoInstall

gatsby-plugin-parse-rss

Package Overview
Dependencies
114
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    gatsby-plugin-parse-rss

Add RSS feed into your Gatsby site.


Version published
Weekly downloads
29
increased by70.59%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

gatsby-plugin-parse-rss

Add RSS feed into your Gatsby site.

Install

npm i gatsby-plugin-parse-rss

or

yarn add gatsby-plugin-parse-rss

How to Use

Add the plugin in your gatsby-config.js

plugins: [
  {
    resolve: "gatsby-plugin-parse-rss",
    options: {
      rss: [
        {
          urlToFetch:
            "https://www.youtube.com/feeds/videos.xml?channel_id=UChqlNb3LpXclrYsIXzD2q_w",
          selectors: ["media:title", "media:thumbnail", "entry > link"],
          name: "youTubeRSS",
        },
        {
          urlToFetch: "https://girgetto-io.netlify.app/rss.xml",
          selectors: ["title", "link"],
          name: "blogPostRSS",
        },
      ],
    },
  },
];

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

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

Use gatsby's useStaticQuery to retrieve datas

{
  allYouTubeRss {
    nodes {
      media_title
      media_thumbnail
    }
  }
}

This is how the data is retrieved

{
  "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

Keywords

FAQs

Last updated on 09 Sep 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc