gridsome-plugin-rss
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -10,3 +10,9 @@ const RSS = require('rss') | ||
collection.data.forEach(item => { | ||
let collectionData = options.latest ? [...collection.data].reverse() : [...collection.data] | ||
if (options.maxItems) { | ||
collectionData = collectionData.filter((item, index) => index < options.maxItems) | ||
} | ||
collectionData.forEach(item => { | ||
feed.item(options.feedItemOptions(item)) | ||
@@ -13,0 +19,0 @@ }) |
{ | ||
"name": "gridsome-plugin-rss", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Generate an RSS feed from your Gridsome data store", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/darthmeme/gridsome-plugin-rss/tree/master", |
@@ -53,2 +53,14 @@ # gridsome-plugin-rss | ||
#### latest | ||
- Type: `boolean` *optional* | ||
If `true`, sorts your RSS file with newest items at the top. | ||
#### maxItems | ||
- Type: `number` *optional* | ||
Limits the amount of items included in your RSS feed. | ||
**NOTE**: Should be used with `latest` set to `true`, otherwise newer items will be excluded. | ||
#### feedOptions | ||
@@ -64,3 +76,3 @@ - Type `object` *required* | ||
The item level options for your RSS feed. | ||
The item level options for your RSS feed. | ||
For each option (see [dylang/node-rss#itemoptions](https://github.com/dylang/node-rss#itemoptions) for all options), `node` is the object that you passed into [Collection.addNode](https://gridsome.org/docs/data-store-api#collectionaddnodeoptions) | ||
@@ -67,0 +79,0 @@ |
4560
32
122