├── test
├── layout.hbs
├── bar.hbs
├── baz.hbs
└── foo.hbs
├── .gitignore
├── .gitattributes
├── docs
├── examples.md
├── quickstart.md
├── rss.md
└── options.md
├── lib
└── utils.js
├── .travis.yml
├── helper.js
├── .verbrc.md
├── LICENSE
├── package.json
├── Gruntfile.js
├── rss.js
└── README.md
/test/layout.hbs:
--------------------------------------------------------------------------------
1 |
{{title}}
2 | {{description}}
3 |
--------------------------------------------------------------------------------
/test/bar.hbs:
--------------------------------------------------------------------------------
1 | ---
2 | title: bar
3 | description: This is bar.
4 | ---
5 |
--------------------------------------------------------------------------------
/test/baz.hbs:
--------------------------------------------------------------------------------
1 | ---
2 | title: baz
3 | description: This is baz.
4 | ---
5 |
--------------------------------------------------------------------------------
/test/foo.hbs:
--------------------------------------------------------------------------------
1 | ---
2 | title: Foo
3 | description: This is foo.
4 | rss: false
5 | ---
6 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | npm-debug.log
3 | .DS_Store
4 |
5 | test/dest
6 |
7 | feed.xml
8 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Set default behaviour, in case users don't have core.autocrlf set.
2 | * text=lf
3 | * text eol=lf
4 | *.* eol=lf
5 |
6 | *.jpg binary
7 | *.gif binary
8 | *.png binary
9 | *.jpeg binary
--------------------------------------------------------------------------------
/docs/examples.md:
--------------------------------------------------------------------------------
1 | Generate feed using only required options.
2 | ```js
3 | options: {
4 | rss: {
5 | title: 'RSS feed description.',
6 | description: 'RSS feed description.'
7 | }
8 | }
9 | ```
10 |
--------------------------------------------------------------------------------
/lib/utils.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Optionally format generated XML
3 | */
4 | exports.format = function(src) {
5 | return require('js-prettify').html(src, {
6 | indent_size: 2,
7 | indent_inner_html: true
8 | }).replace(/(\r\n|\n\r|\n|\r){2,}/g, '\n');
9 | };
10 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - 0.10
4 | - 0.11
5 | before_install: npm install -g grunt-cli
6 | install: npm install
7 | script:
8 | - grunt assemble
9 | - grunt verb
10 | notifications:
11 | email:
12 | recepients:
13 | - patrick@pburtchaell.com
--------------------------------------------------------------------------------
/helper.js:
--------------------------------------------------------------------------------
1 | module.exports.register = function(Handlebars, options) {
2 |
3 | /**
4 | * TODO:
5 | * This is a placeholder for some helpers to create for this plugin.
6 | * - class name
7 | * - text link or icon.
8 | * - icons: `icon="16"`
9 | * - automatically calculate path based on RSS feed
10 | */
11 |
12 | Handlebars.registerHelper('rss', function(options) {
13 | return '';
14 | });
15 |
16 | };
17 |
--------------------------------------------------------------------------------
/docs/quickstart.md:
--------------------------------------------------------------------------------
1 | From the same directory as your project's [gruntfile][Getting Started] and [package.json][], install this plugin:
2 |
3 | ```bash
4 | npm install {%= name %} --save-dev
5 | ```
6 |
7 | Next add `{%= name %}`, the name of this module, to the `plugins` option in the Assemble task:
8 |
9 | ```js
10 | options: {
11 | plugins: ['assemble-middleware-rss'],
12 | rss: {
13 | title: 'RSS Feed Title',
14 | description: 'RSS feed description.'
15 | }
16 | }
17 | ```
18 |
19 | *Note*: Author is also required, but it is pulled from `package.json` by default. As long as you have a `package.json` file in the root directory, you don't need to include author in the options.
20 |
21 | See the [options](#options) for further configuration.
22 |
--------------------------------------------------------------------------------
/.verbrc.md:
--------------------------------------------------------------------------------
1 | ---
2 | dest: ./README.md
3 | ---
4 | # {%= name %} [](http://badge.fury.io/js/{%= name %}) {% if (travis) { %} []({%= travis %}){% } %}
5 |
6 | > {%= description %}
7 |
8 | ## Quickstart
9 | {%= docs("quickstart") %}
10 |
11 | ## Options
12 | {%= docs("options") %}
13 |
14 | ## Usage Examples
15 | {%= docs("examples") %}
16 |
17 | ## RSS Specifications
18 | {%= docs("rss") %}
19 |
20 | ***
21 | Built with care by [Patrick Burtchaell](http://twitter.com/pburtchaell) in New Orleans.
22 |
23 | Copyright (c) 2014 Patrick Burtchaell, Jon Schlinkert, contributors. Released under the MIT license.
24 |
25 | [grunt]: http://gruntjs.com/
26 | [Getting Started]: https://github.com/gruntjs/grunt/blob/devel/docs/getting_started.md
27 |
28 |
--------------------------------------------------------------------------------
/docs/rss.md:
--------------------------------------------------------------------------------
1 | ### RSS Feed
2 |
3 | The RSS feed is generated using the [RSS module](http://npmjs.org/rss), a fast and simple RSS generator/builder for Node projects by Dylan Greene. Some of the options this module has are not fully documented here, but are availabe; the information you might need should be with in Greene's documentation.
4 |
5 | The content for the RSS feed is pulled from several sources.
6 |
7 | As much of the content for the feed as possible is pulled from `package.json`, e.g. the author name and email; the site name and url. This functionality can be overidden by specifying the feed data in the plugin configuartion. See the [options documentaion](#rss-feed-data).
8 |
9 | ### RSS Feed Items
10 |
11 | The data for each item is pulled from YAML Front Matter (YFM).
12 | ```
13 | title: foo
14 | desciption: bar
15 | ```
16 |
17 | If you do not want to include a page in the RSS feed, you don't have to.
18 | ```
19 | rss: false
20 | ```
21 |
22 | The item data you can define in the YFM is listed under [the options](#rss-item-options)
23 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014 Patrick Burtchaell
2 |
3 | Permission is hereby granted, free of charge, to any person
4 | obtaining a copy of this software and associated documentation
5 | files (the "Software"), to deal in the Software without
6 | restriction, including without limitation the rights to use,
7 | copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the
9 | Software is furnished to do so, subject to the following
10 | conditions:
11 |
12 | The above copyright notice and this permission notice shall be
13 | included in all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 | OTHER DEALINGS IN THE SOFTWARE.
23 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "assemble-middleware-rss",
3 | "description": "RSS generator plugin for Assemble.",
4 | "version": "0.2.5",
5 | "homepage": "https://github.com/assemble/assemble-middleware-rss",
6 | "author": "Patrick Burtchael (https://pburtchaell.com/)",
7 | "repository": {
8 | "type": "git",
9 | "url": "https://github.com/assemble/assemble-middleware-rss.git"
10 | },
11 | "bugs": {
12 | "url": "https://github.com/assemble/assemble-middleware-rss/issues"
13 | },
14 | "license": "MIT",
15 | "main": "./rss.js",
16 | "engines": {
17 | "node": ">= 0.8.0"
18 | },
19 | "dependencies": {
20 | "async": "^0.9.0",
21 | "chalk": "~0.4.0",
22 | "frep": "~0.1.2",
23 | "js-prettify": "~1.4.0",
24 | "lodash": "^2.4.1",
25 | "moment": "~2.2.1",
26 | "rss": "~0.3.2"
27 | },
28 | "devDependencies": {
29 | "assemble": "~0.4.12",
30 | "grunt": "~0.4.1",
31 | "grunt-contrib-clean": "~0.5.0",
32 | "grunt-verb": "latest",
33 | "js-prettify": "~1.4.0"
34 | },
35 | "peerDependencies": {
36 | "assemble": "~0.4.12"
37 | },
38 | "keywords": [
39 | "blog",
40 | "moment",
41 | "moment.js",
42 | "parse url",
43 | "RSS",
44 | "post",
45 | "pretty links",
46 | "slug",
47 | "uri",
48 | "url",
49 | "yaml front matter"
50 | ]
51 | }
52 |
--------------------------------------------------------------------------------
/Gruntfile.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | module.exports = function(grunt) {
4 |
5 | var testsrc = {
6 | expand: true,
7 | cwd: 'test/',
8 | src: ['*.hbs','!layout.hbs'],
9 | dest: 'test/dest'
10 | };
11 |
12 | grunt.initConfig({
13 |
14 | assemble: {
15 | options: {
16 | plugins: ['./rss.js'],
17 | layout: 'test/layout.hbs',
18 | },
19 |
20 | /**
21 | * Test #1:
22 | *
23 | * @expectation Feed does not generate.
24 | */
25 | 'test-1': {
26 | files: [ testsrc ]
27 | },
28 |
29 | /**
30 | * Test #2:
31 | *
32 | * @desc Test multiple plugins together.
33 | * @expecation Generated feed successfully.
34 | */
35 | 'test-2': {
36 | options: {
37 | flatten: true,
38 | permalinks: {
39 | preset: 'pretty'
40 | },
41 | rss: {
42 | logging: true,
43 | format: true,
44 | author: 'Jon Doe',
45 | dest: 'feed.xml',
46 | siteurl: 'http://example.com'
47 | }
48 | },
49 | files: [ testsrc ]
50 | },
51 |
52 | /**
53 | * Test #3:
54 | *
55 | * @desc Test assemble build without plugins.
56 | * @expecation Generated pages successfully.
57 | */
58 | 'test-3': {
59 | files: [ testsrc ]
60 | }
61 |
62 | },
63 |
64 | clean: { actual: ['test/dest'] }
65 |
66 | });
67 |
68 | grunt.loadNpmTasks('grunt-contrib-clean');
69 | grunt.loadNpmTasks('grunt-verb');
70 | grunt.loadNpmTasks('assemble');
71 |
72 | grunt.registerTask('default', ['clean', 'assemble', 'verb']);
73 |
74 | };
75 |
--------------------------------------------------------------------------------
/docs/options.md:
--------------------------------------------------------------------------------
1 | ### Plugin Options
2 | | Option | Type | Description | Default Value |
3 | |:----------|:-------:|------------------------------------------|---------------|
4 | | `format` | boolean | Format output XML file using js-prettify | `false` |
5 | | `dest` | string | Destination and filename of the generated RSS feed |`'feed.xml'` |
6 |
7 | ### RSS Feed Data
8 | > Data for the RSS `` element.
9 |
10 | This data is defined under the plugin configuration.
11 |
12 | ```js
13 | assemble: {
14 | options: {
15 | rss: {
16 | title: 'foo',
17 | description: 'bar'
18 | }
19 | }
20 | }
21 | ```
22 |
23 | | Required | Type | Desciption | Default Value |
24 | |:-------------|:------:|--------------------------------------|----------------:|
25 | | `title` | string | Defines the title of the channel | pkg.name |
26 | | `description`| string | Describes the channel | pkg.description |
27 | | `link` | string | Defines the hyperlink to the channel | pkg.homepage |
28 |
29 | | Optional | Type | Description | Default Value |
30 | |:----------------|:------:|-------------|--------------:|
31 | | `categories` | array | Defines one or more categories for the feed |
32 | | `cloud` | string | Register processes to be notified immediately of updates of the feed | |
33 | | `copyright` | string | Notifies about copyrighted material |
34 | | `docs` | string | Specifies an URL to the documentation of the format used in the feed |
35 | | `generator` | string | Specifies the program used to generate the feed |
36 | | `image` | string | Allows an image to be displayed when aggregators present a feed |
37 | | `language` | string | Specifies the language the feed is written in | 'en'
38 | | `lastBuildDate` | string | Defines the last-modified date of the content of the feed |
39 | | `managingEditor`| string | Defines the e-mail address to the editor of the content of the feed |
40 | | `pubDate` | string | Defines the last publication date for the content of the feed |
41 | | `rating` | string | The PICS rating of the feed |
42 | | `skipDays` | string | Specifies the days where aggregators should skip updating the feed |
43 | | `skipHours` | string | Specifies the hours where aggregators should skip updating the feed |
44 | | `textInput` | string | pecifies a text input field that should be displayed with the feed |
45 | | `ttl` | string | Specifies the number of minutes the feed can stay cached | '60' |
46 | | `webmaster` | string | Defines the email address to the webmaster of the feed |
47 | | `geoRSS` | boolean| Enable or disable GeoRSS | false
48 |
49 | ### RSS Item Data
50 | > Data for the RSS `- `element(s).
51 |
52 | The data for feed items is generally grabbed from the YAML Front Matter.
53 | ```
54 | title: Foo
55 | desciption: This is foo.
56 | ```
57 |
58 | Three values are required for the RSS feed to generate:
59 |
60 | | Value | Type | Description |
61 | |:--------------|:------:|---------------------------------------------------|
62 | | `title` | string | Defines the title of the item |
63 | | `description` | string | Describes the item |
64 |
65 | All other values are optional:
66 |
67 | | Value | Type | Desciption |
68 | |:--------------|:------:|--------------------------------------------------------|
69 | | `author` | string | Specifies the e-mail address to the author of the item |
70 | | `date` | string | Defines the last-publication date for the item |
71 | | `link` | string | Defines the hyperlink to the item |
72 | | `categories` | string | Defines one or more categories the item belongs to |
73 | | `comments` | string | Allows an item to link to comments about that item |
74 | | `guid` | string | Defines a unique identifier for the item |
75 | | `source` | string | Specifies a third-party source for the item |
76 | | `lat` | number | The latitude coordinate of the item |
77 | | `long` | number | The longitude coordinate of the item |
78 |
79 | ### Excluding content
80 | Both `published: false` and `rss: false` will exclude an item from the feed. However, note that `published: false` will entirely prevent a page from being assembled.
81 |
--------------------------------------------------------------------------------
/rss.js:
--------------------------------------------------------------------------------
1 | var path = require('path');
2 | var url = require('url');
3 | var fs = require('fs');
4 | var chalk = require('chalk');
5 | var moment = require('moment');
6 | var async = require('async');
7 | var rss = require('rss');
8 | var _ = require('lodash');
9 | var utils = require('./lib/utils');
10 |
11 | module.exports = function (config, callback) {
12 |
13 | 'use strict';
14 |
15 | var pkg = require(path.join(process.cwd(), 'package.json'));
16 |
17 | var options = config.context;
18 | var config = options.rss || {};
19 |
20 | var pages = options.pages; // Define an array all of page data.
21 | var page = options.page; // Define a single page's data object.
22 |
23 | // Skip over the plugin if it isn't defined in the options.
24 | if (!_.isUndefined(config)) {
25 |
26 | /**
27 | * @function fail
28 | * @param {string} 'property' - The undefined property.
29 | * @desc Stops Grunt with a fatal failure.
30 | */
31 | var fail = function (property) {
32 | if (config.logging) {
33 | /**
34 | * @function message
35 | * @param 'cb' - A callback to run after the message is logged.
36 | * @desc Log a message to the console and kill Assemble.
37 | */
38 | var message = function (cb) {
39 | console.log('RSS property ' +
40 | chalk.yellow(property) +
41 | ' is not defined ' +
42 | chalk.red('ERROR'));
43 | cb();
44 | };
45 |
46 | // Show the message and kill Grunt/gulp.
47 | return message(function () {
48 | process.kill();
49 | });
50 | } else return;
51 | };
52 |
53 | /**
54 | * If package.json has an author string instead of an author object,
55 | * split the string so the data can be used in templates.
56 | *
57 | * For example, we need to turn:
58 | * `"author": "Name (url)"` into
59 | * `"author": { "name": "name", "email": "email", "url": "url" }`
60 | */
61 | if (typeof pkg.author === 'string') {
62 |
63 | // Split the string into an array.
64 | var array = pkg.author.split(/<|>/);
65 |
66 | // Clean up the name and URL strings, but only if they exist.
67 | if (array[0]) {
68 | array[0] = array[0].slice(0, -1);
69 | } else if (array[2]) {
70 | array[2] = array[2].substr(2).slice(0, -1);
71 | };
72 |
73 | // Create the new author object
74 | var author = {
75 | name: array[0],
76 | email: array[1],
77 | url: array[2]
78 | };
79 |
80 | // Update the pkg (package.json) object
81 | pkg.author = author;
82 | };
83 |
84 | /**
85 | * @object defaults
86 | * @desc Set default values for the RSS feed data.
87 | */
88 | var defaults = {
89 | title: pkg.name,
90 | author: pkg.author.name,
91 | description: pkg.description,
92 | copyright: 'Copyright ' + moment().format("YYYY") + ' ' + pkg.author.name,
93 | generator: 'Generated by Assemble.js.',
94 | lastBuildDate: moment().format("dddd, MMMM Do YYYY"),
95 | pubdate: moment().format(),
96 | siteurl: pkg.homepage,
97 | feedurl: url.resolve(pkg.homepage, config.dest || 'feed.xml'),
98 | language: 'en',
99 | ttl: '60',
100 | geoRSS: false,
101 | };
102 |
103 | moment.lang(config.language || defaults.language); // Moment.js default language
104 |
105 | /**
106 | * @function feed
107 | * @desc Generate the feed using the rss module.
108 | * The idea here is to check is a property is defined in
109 | * the plugin configuration. If it is not, pull it from the
110 | * defaults object (which is defined above). In some cases where a
111 | * a required property is not specified in the config and the
112 | * default will not solve that issue, the `fail()` function will
113 | * be called, thus stoping the task.
114 | */
115 | var feed = new rss({
116 | generator: config.generator || defaults.generator,
117 | lastBuildDate: defaults.lastBuildDate,
118 | title: config.title || defaults.title || fail('title'),
119 | description: config.description || defaults.description || fail('description'),
120 | pubdate: config.pubdate || defaults.pubdate,
121 | site_url: config.siteurl || defaults.siteurl,
122 | feed_url: config.feedurl || defaults.feedurl,
123 | image_url: config.imageurl,
124 | author: config.author || defaults.author || fail('author'),
125 | managingEditor: config.managingEditor,
126 | webMaster: config.webMaster,
127 | categories: config.categories,
128 | docs: config.docs,
129 | copyright: config.copyright || defaults.copyright,
130 | language: config.language || defaults.language,
131 | ttl: config.ttl || defaults.ttl,
132 | geoRSS: config.geoRSS || defaults.geoRSS
133 | });
134 |
135 | /**
136 | * @function addItem
137 | * @param {object} 'itemData'
138 | * @desc Add an item to the RSS feed.
139 | */
140 | var addItem = function (itemData) {
141 | feed.item(itemData);
142 | };
143 |
144 | async.eachSeries(pages, function (file, next) {
145 |
146 | var page = file.data;
147 |
148 | /**
149 | * @object defaults.item
150 | * @desc Sets default values for each item in the RSS feed.
151 | */
152 | defaults.item = {
153 | title: page.title || fail('title'),
154 | author: defaults.author || page.author || fail('author'),
155 | description: page.description || fail('description'),
156 | url: url.resolve(pkg.homepage, file.relativeLink),
157 | guid: page.guid || page.url,
158 | categories: page.categories,
159 | lat: page.lat,
160 | long: page.long
161 | };
162 |
163 | // If "rss: false" does not exist in the YFM, then add the item.
164 | if (page.rss != false) {
165 | addItem(defaults.item);
166 | };
167 |
168 | next();
169 | }, function (err) {
170 | callback();
171 | });
172 |
173 | var output = feed.xml(); // cache the XML output to a variable
174 | if (config.format === true) output = utils.format(output); // format XML if true
175 |
176 | /**
177 | * I could use `grunt.file.write()` but I am trying to future
178 | * proof this middleware for versions of assemble that don't depend on
179 | * grunt.
180 | */
181 | var dest = config.dest || path.join(page.dirname,'feed.xml');
182 | fs.writeFileSync(dest, output);
183 |
184 | };
185 | };
186 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # assemble-middleware-rss [](http://badge.fury.io/js/assemble-middleware-rss) [](https://travis-ci.org/assemble/assemble-middleware-rss)
2 |
3 | > RSS generator plugin for Assemble.
4 |
5 | ## Quickstart
6 | From the same directory as your project's [gruntfile][Getting Started] and [package.json][], install this plugin:
7 |
8 | ```bash
9 | npm install assemble-middleware-rss --save-dev
10 | ```
11 |
12 | Next add `assemble-middleware-rss`, the name of this module, to the `plugins` option in the Assemble task:
13 |
14 | ```js
15 | options: {
16 | plugins: ['assemble-middleware-rss'],
17 | rss: {
18 | title: 'RSS Feed Title',
19 | description: 'RSS feed description.'
20 | }
21 | }
22 | ```
23 |
24 | *Note*: Author is also required, but it is pulled from `package.json` by default. As long as you have a `package.json` file in the root directory, you don't need to include author in the options.
25 |
26 | See the [options](#options) for further configuration.
27 |
28 |
29 | ## Options
30 | #### Plugin Options
31 | | Option | Type | Description | Default Value |
32 | |:----------|:-------:|------------------------------------------|---------------|
33 | | `format` | boolean | Format output XML file using js-prettify | `false` |
34 | | `dest` | string | Destination and filename of the generated RSS feed |`'feed.xml'` |
35 |
36 | #### RSS Feed Data
37 | > Data for the RSS `` element.
38 |
39 | This data is defined under the plugin configuration.
40 |
41 | ```js
42 | assemble: {
43 | options: {
44 | rss: {
45 | title: 'foo',
46 | description: 'bar'
47 | }
48 | }
49 | }
50 | ```
51 |
52 | | Required | Type | Desciption | Default Value |
53 | |:-------------|:------:|--------------------------------------|----------------:|
54 | | `title` | string | Defines the title of the channel | pkg.name |
55 | | `description`| string | Describes the channel | pkg.description |
56 | | `link` | string | Defines the hyperlink to the channel | pkg.homepage |
57 |
58 | | Optional | Type | Description | Default Value |
59 | |:----------------|:------:|-------------|--------------:|
60 | | `categories` | array | Defines one or more categories for the feed |
61 | | `cloud` | string | Register processes to be notified immediately of updates of the feed | |
62 | | `copyright` | string | Notifies about copyrighted material |
63 | | `docs` | string | Specifies an URL to the documentation of the format used in the feed |
64 | | `generator` | string | Specifies the program used to generate the feed |
65 | | `image` | string | Allows an image to be displayed when aggregators present a feed |
66 | | `language` | string | Specifies the language the feed is written in | 'en'
67 | | `lastBuildDate` | string | Defines the last-modified date of the content of the feed |
68 | | `managingEditor`| string | Defines the e-mail address to the editor of the content of the feed |
69 | | `pubDate` | string | Defines the last publication date for the content of the feed |
70 | | `rating` | string | The PICS rating of the feed |
71 | | `skipDays` | string | Specifies the days where aggregators should skip updating the feed |
72 | | `skipHours` | string | Specifies the hours where aggregators should skip updating the feed |
73 | | `textInput` | string | pecifies a text input field that should be displayed with the feed |
74 | | `ttl` | string | Specifies the number of minutes the feed can stay cached | '60' |
75 | | `webmaster` | string | Defines the email address to the webmaster of the feed |
76 | | `geoRSS` | boolean| Enable or disable GeoRSS | false
77 |
78 | #### RSS Item Data
79 | > Data for the RSS `
- `element(s).
80 |
81 | The data for feed items is generally grabbed from the YAML Front Matter.
82 | ```
83 | title: Foo
84 | desciption: This is foo.
85 | ```
86 |
87 | Three values are required for the RSS feed to generate:
88 |
89 | | Value | Type | Description |
90 | |:--------------|:------:|---------------------------------------------------|
91 | | `title` | string | Defines the title of the item |
92 | | `description` | string | Describes the item |
93 |
94 | All other values are optional:
95 |
96 | | Value | Type | Desciption |
97 | |:--------------|:------:|--------------------------------------------------------|
98 | | `author` | string | Specifies the e-mail address to the author of the item |
99 | | `date` | string | Defines the last-publication date for the item |
100 | | `link` | string | Defines the hyperlink to the item |
101 | | `categories` | string | Defines one or more categories the item belongs to |
102 | | `comments` | string | Allows an item to link to comments about that item |
103 | | `guid` | string | Defines a unique identifier for the item |
104 | | `source` | string | Specifies a third-party source for the item |
105 | | `lat` | number | The latitude coordinate of the item |
106 | | `long` | number | The longitude coordinate of the item |
107 |
108 | #### Excluding content
109 | Both `published: false` and `rss: false` will exclude an item from the feed. However, note that `published: false` will entirely prevent a page from being assembled.
110 |
111 |
112 | ## Usage Examples
113 | Generate feed using only required options.
114 | ```js
115 | options: {
116 | rss: {
117 | title: 'RSS feed description.',
118 | description: 'RSS feed description.'
119 | }
120 | }
121 | ```
122 |
123 |
124 | ## RSS Specifications
125 | #### RSS Feed
126 |
127 | The RSS feed is generated using the [RSS module](http://npmjs.org/rss), a fast and simple RSS generator/builder for Node projects by Dylan Greene. Some of the options this module has are not fully documented here, but are availabe; the information you might need should be with in Greene's documentation.
128 |
129 | The content for the RSS feed is pulled from several sources.
130 |
131 | As much of the content for the feed as possible is pulled from `package.json`, e.g. the author name and email; the site name and url. This functionality can be overidden by specifying the feed data in the plugin configuartion. See the [options documentaion](#rss-feed-data).
132 |
133 | #### RSS Feed Items
134 |
135 | The data for each item is pulled from YAML Front Matter (YFM).
136 | ```
137 | title: foo
138 | desciption: bar
139 | ```
140 |
141 | If you do not want to include a page in the RSS feed, you don't have to.
142 | ```
143 | rss: false
144 | ```
145 |
146 | The item data you can define in the YFM is listed under [the options](#rss-item-options)
147 |
148 |
149 | ***
150 | Built with care by [Patrick Burtchaell](http://twitter.com/pburtchaell) in New Orleans.
151 |
152 | Copyright (c) 2014 Patrick Burtchaell, Jon Schlinkert, contributors. Released under the MIT license.
153 |
154 | [grunt]: http://gruntjs.com/
155 | [Getting Started]: https://github.com/gruntjs/grunt/blob/devel/docs/getting_started.md
156 |
157 |
--------------------------------------------------------------------------------