mottox2 / gatsby-source-rss-feed

Gatsby source plugin for rss feed.
https://www.npmjs.com/package/gatsby-source-rss-feed
24 stars 6 forks source link

How to query multiple feeds? #8

Closed Bechrissed closed 4 years ago

Bechrissed commented 4 years ago

Hi,

Thank you for the plugin. Working very well. I'm quite new with GraphQL. How would I configure the plugin to be able to query multiple feeds? Let's say I would have a local JSON file as following:

{
    "sport": [{
            "name": "sport 1",
            "url": "https://sportfeed1.com/rss.xml"
        },
        {
            "name": "sport 2",
            "url": "https://sportfeed2.com/rss.xml"
        }
    ],
    "news": [{
            "name": "news 1",
            "url": "https://newsfeed1.com/rss.xml"
        },
        {
            "name": "news 2 2",
            "url": "https://newsfeed2.com/rss.xml"
        }
    ]
}
carljbusch commented 4 years ago

Here is how I figured it out and works fine

 {
      resolve: `gatsby-source-rss-feed`,
      options: {
        url: `https://whatever`,
        name: `Podcast1`,
        parserOption: {
          customFields: {
            item: ['itunes:image']
          }
        }
      },
    },
    {
      resolve: `gatsby-source-rss-feed`,
      options: {
        url: `https://whatever`,
        name: `Podcast2`,
        parserOption: {
          customFields: {
            item: ['itunes:image']
          }
        }
      },
    },