simnon / gatsby-source-opml-overcast

Gatsby source plugin allowing to read OPML files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gatsby-source-opml

Gatsby source plugin exposing content of OPML file as GraphQL resource.

Two types of queries Podcast data using allOpmlPodcast Podcast episode data using allOpmlPodcastEpisodes

Install

npm install --save gatsby-source-opml

How to use

In order to use this plugin you must have a valid OPML file in your Gatsby project workspace. Typically, those files are exported by podcast players (like Pocket Casts).

// In your gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: "gatsby-source-opml",
      options: {
        // Url to opml file, relative to project root directory
        file: `data/podcasts.opml`,
      },
    },
  ]
};

How to query

query RetrieveAllPodcasts {
  allOpmlPodcast {
    edges {
      node {
        id
        name
        description
        url
        image {
          url
        }
      }
    }
  }
}

query FavoritedPodcastEpisodes {
  allOpmlPodcastEpisodes(filter: {favorited: {eq: true}}) {
    edges {
      node {
        podcastTitle
        episodeData
        name
        favorited
        publishDate
      }
    }
  }
}

About

Gatsby source plugin allowing to read OPML files.

License:MIT License


Languages

Language:JavaScript 100.0%