mirror of
https://github.com/LightAir/turbo-rss.git
synced 2026-02-04 12:06:20 +00:00
6c67227534a7cbde43d02281e9faf5948a4e8015
WIP
turbo-rss
RSS based, feed generator for Yandex turbo.
WARNING! Work In Progress
Usage
Create a new feed
var TR = require('turbo-rss');
var feed = new TS(feedOptions);
feedOptions
titlestring Title of your site or feeddescriptionoptional string A short description of the feed.authoroptional string If included it is the name of the item's creator.linkurl string Url to the site that the feed is for.pubDateoptional Date object or date string The publication date for content in the feed
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.
feed.item(itemOptions);
itemOptions
titlestring Title of this particular item.image_urlurl string Link to header imageurlurl string Url to the item. This could be a blog entry.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.datestring 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 determinecontentstring Content
Feed XML
var xml = feed.xml();
This returns the XML as a string.
maybe later...
indentoptional 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 totrueit will use four spaces.
Example Usage
var RSS = require('rss');
/* lets create feed */
var feed = new RSS({
title: 'title',
description: 'description',
link: 'http://example.com', // site url
author: 'LightAir',
pubDate: 'May 20, 2012 04:00:00 GMT'
});
/* loop over data and add to feed */
feed.item({
title: 'item title',
image_url: 'http://example.com/example.png',
url: 'http://example.com/article4?this&that', // link to the item
author: 'LightAir', // optional - defaults to feed author property
date: 'May 27, 2012',
content: '<p>hello</p>'
});
// cache the xml to send to clients
var xml = feed.xml();
Contributing
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.
Tests
Tests included use Mocha. Use npm test to run the tests.
$ npm test
Languages
JavaScript
100%