RSS feed generator. Add RSS feeds to any project. Supports enclosures and GeoRSS.
Create a new feed
var RSS = ;var feed = feedOptions;
titlestring Title of your site or feed
descriptionoptional string A short description of the feed.
generatoroptional string Feed generator.
feed_urlurl string Url to the rss feed.
site_urlurl string Url to the site that the feed is for.
image_urloptional url string Small image for feed readers to use.
docsoptional url string Url to documentation on this feed.
managingEditoroptional string Who manages content in this feed.
webMasteroptional string Who manages feed availability and technical support.
copyrightoptional string Copyright information for this feed.
languageoptional string The language of the content of this feed.
categoriesoptional array of strings One or more categories this feed belongs to.
pubDateoptional Date object or date string The publication date for content in the feed
ttloptional integer Number of minutes feed can be cached before refreshing from source.
huboptional PubSubHubbub hub url Where is the PubSubHub hub located.
custom_namespacesoptional object Put additional namespaces in element (without 'xmlns:' prefix)
custom_elementsoptional array Put additional elements in the feed (node-xml syntax)
Add items to a feed
An item can be used for a blog entry, project update, log entry, etc. Your RSS feed can have any number of items. Most feeds use 20 or fewer items.
titlestring Title of this particular item.
descriptionstring Content for the item. Can contain html but link and image urls must be absolute path including hostname.
urlurl string Url to the item. This could be a blog entry.
guidunique string A unique string feed readers use to know if an item is new or has already been seen. If you use a guid never change it. If you don't provide a guid then your item urls must be unique.
categoriesoptional array of strings If provided, each array item will be added as a category element
authoroptional string If included it is the name of the item's creator. If not provided the item author will be the same as the feed author. This is typical except on multi-author blogs.
dateDate object or date string The date and time of when the item was created. Feed readers use this to determine the sort order. Some readers will also use it to determine if the content should be presented as unread.
latoptional number The latitude coordinate of the item.
longoptional number The longitude coordinate of the item.
custom_elementsoptional array Put additional elements in the item (node-xml syntax)
enclosureoptional object An enclosure object/* enclosure takes url or file key for the enclosure objecturl: _required_ url to file object (or file)file: _required_ path to binary file (or url)size: _optional_ size of the filetype: _optional_ if not provided the mimetype will be guessedbased on the extension of the file or url,passing type to the enclosure will override the guessed type*/'url' : 'http://www.example.com/path/to/image''size' : 1668 //'type' : 'image/jpeg'
var xml = feed;
This returns the XML as a string.
indent optional boolean or string What to use as a tab. Defaults to no tabs (compressed).
For example you can use
'\t' for tab character, or
' ' for two-space tabs. If you set it to
true it will use four spaces.
var RSS = ;/* lets create an rss feed */var feed =title: 'title'description: 'description'feed_url: 'http://example.com/rss.xml'site_url: 'http://example.com'image_url: 'http://example.com/icon.png'docs: 'http://example.com/rss/docs.html'managingEditor: 'Dylan Greene'webMaster: 'Dylan Greene'copyright: '2013 Dylan Greene'language: 'en'categories: 'Category 1''Category 2''Category 3'pubDate: 'May 20, 2012 04:00:00 GMT'ttl: '60'custom_namespaces:'itunes': 'http://www.itunes.com/dtds/podcast-1.0.dtd'custom_elements:'itunes:subtitle': 'A show about everything''itunes:author': 'John Doe''itunes:summary': 'All About Everything is a show about everything. Each week we dive into any subject known to man and talk about it as much as we can. Look for our podcast in the Podcasts app or in the iTunes Store''itunes:owner':'itunes:name': 'John Doe''itunes:email': 'email@example.com''itunes:image':_attr:href: 'http://example.com/podcasts/everything/AllAboutEverything.jpg''itunes:category':_attr:text: 'Technology''itunes:category':_attr:text: 'Gadgets';/* loop over data and add to feed */feed;// cache the xml to send to clientsvar xml = feed;
- You do not need to escape anything. This module will escape characters when necessary.
- This module is very fast but you might as well cache the output of xml() and serve it until something changes.
I started this module years ago (April 2011) because there weren't any Node modules for creating RSS. Nearly 50 modules use RSS, as well as many web sites and the popular Ghost publishing platform.
Contributions to the project are welcome. Feel free to fork and improve. I do my best accept pull requests in a timely manor, especially when tests and updated docs are included.
About the Author
Hi! Thanks for checking out this project! My name is Dylan Greene. When not overwhelmed with my two young kids I enjoy contributing to the open source community. I'm also a tech lead at Opower.
Here's some of my other Node projects:
||Check for outdated, incorrect, and unused dependencies.|
||Automatic desktop notifications for Grunt errors and warnings. Supports OS X, Windows, Linux.|
||Amazingly short non-sequential url-friendly unique id generator.|
||Interactive prompt for your Grunt config using console checkboxes, text input with filtering, password fields.|
||Fast and simple xml generator. Supports attributes, CDATA, etc. Includes tests and examples.|
||Command line tool (and Node module) that generates a changelog in color output, markdown, or json for modules in npmjs.org's registry as well as any public github.com repo.|
||Discover surprisingly large directories from the command line.|
||Beautiful UI for showing tasks running on the command line.|
||Get captions for image using Microsoft's CaptionBot 🤖|
||Display attention-grabbing messages in the terminal|
||Get the breed of a dog from an image using Microsoft's what-dog.|
||Module information and stats for any @npmjs user|
||Get a random imgur image url, by default a puppy.|
||Echo a file to the terminal. Works with text, figlets, ascii art, and full-color ansi.|
This list was generated using anthology.
Copyright (c) 2017 Dylan Greene, contributors.
Released under the MIT license.
Screenshots are CC BY-SA (Attribution-ShareAlike).
Generated using grunt-readme with grunt-templates-dylang on Wednesday, January 11, 2017.
_To make changes to this document look in