@microflash/gridsome-plugin-feed

    1.2.1 • Public • Published

    Gridsome Feed Plugin

    npm license

    A Gridsome plugin to generate RSS, Atom and JSON feeds

    Install

    yarn add @microflash/gridsome-plugin-feed
    npm install @microflash/gridsome-plugin-feed

    Usage

    // gridsome.config.js
    
    module.exports = {
      plugins: [
        {
          use: '@microflash/gridsome-plugin-feed',
          options: {
    
            // (required) Provide GraphQL collection types
            contentTypes: ['BlogPost'],
    
            // (optional) Properties used by feed API
            // See https://github.com/jpmonette/feed#example for all options
            feedOptions: {
              title: 'My blog',
              description: 'My Personal blog on books, cookies and kittens'
            },
    
            // Available options with their default values
    
            // (optional) Options for feed formats
            // RSS is enabled by default
            rss: {
              enabled: true,
              output: '/feed.xml'
            },
            atom: {
              enabled: false,
              output: '/feed.atom'
            },
            json: {
              enabled: false,
              output: '/feed.json'
            },
    
            // (optional) number of items to include in a feed
            maxItems: 25,
    
            // (optional) an array of properties to be parsed as HTML
            // Converts relative URLs to absolute URLs
            // You can disable this by omitting the option
            htmlFields: ['content'],
    
            // (optional) appends a trailing slash to the URLs
            enforceTrailingSlashes: false,
    
            // (optional) a function to filter out the nodes
            // e.g., filter out all outdated posts, filterNodes: (node) => !!node.outdated
            filterNodes: (node) => true,
    
            // (optional) sets the properties on each feed item
            // See https://github.com/jpmonette/feed#example for all options
            nodeToFeedItem: (node) => ({
              title: node.title,
              date: node.date,
              content: node.content
            })
          }
        }
      ]
    }

    Contribute

    Feel free to contribute to the project. Take a look at the contribution guidelines to get started.

    Credits

    @onecrayon for implementing the original plugin

    Install

    npm i @microflash/gridsome-plugin-feed

    DownloadsWeekly Downloads

    95

    Version

    1.2.1

    License

    MIT

    Unpacked Size

    17.8 kB

    Total Files

    7

    Last publish

    Collaborators

    • avatar