gatsby-plugin-rsshub

1.2.4 • Public • Published

gatsby-plugin-rsshub

Generate static xml from rsshub

NOTE: This plugin only generates output when run in production mode! To test your sitemap, run: gatsby build && gatsby serve

Pre require

You must install gatsby-source-rsshub first.

Install

npm install --save gatsby-plugin-rsshub

How to Use

// In your gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: `gatsby-plugin-rsshub`
    }

All options:

// In your gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: `gatsby-plugin-rsshub`,
      options: {
        // xml or atom, default xml
        outputType:"xml",
        // default 150
        titleLengthLimit:150,
        // rss output path prefix, base on public , default ""
        prefix:'', 
        // query siteUrl graphql
        query: `
          {
            site {
              siteMetadata {
                siteUrl
              }
            }
          }
        `,
        // should return object with key siteUrl
        serialize({query}){
          return {siteUrl:query.site.siteMetadata.siteUrl}
        },
        // if you need to custom the template data 
        templateDataSerialize(data){
          data.title = 'xxx';
          return data
        },
        // generate meta index page path
        indexPath:"/rsshub",
        // index template component
        indexComponent:""
      },
    },
  ],
}

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.2.4
    0
    • latest

Version History

Package Sidebar

Install

npm i gatsby-plugin-rsshub

Weekly Downloads

6

Version

1.2.4

License

MIT

Unpacked Size

14.6 kB

Total Files

9

Last publish

Collaborators

  • theowenyoung