Skip to content
This repository has been archived by the owner on Dec 7, 2018. It is now read-only.
/ meteor-rssfeed Public archive

Adds basic support for rss feed v2.0

License

Notifications You must be signed in to change notification settings

lookback/meteor-rssfeed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RSS Feed Donate

A package for serving data in RSS 2.0 XML format for Meteor

This package requires Meteor 0.6.5+ and only have an server-side api

#What is it?

It serves published data mounted on http://mysite.meteor.com/rss/name

or with a querystring http://mysite.meteor.com/rss/news?foo=latest

#How?

Add the package

  mrt add rssfeed

Publish a feed

RssFeed.publish('test', function(query) {
  var self = this;
  // We got 3 helpers:
  // 1. self.setValue
  // 2. self.addItem
  // 3. self.cdata


  // query is the parsed querystring as an object
  // eg. foo=latest would be query.foo === 'latest'

  // feed handler helpers
  // this.cdata, this.setValue, this.addItem
  self.setValue('title', self.cdata('My news'));
  self.setValue('description', self.cdata('This is a live feed'));
  self.setValue('link', 'http://mysite.meteor.com');
  self.setValue('lastBuildDate', new Date());
  self.setValue('pubDate', new Date());
  self.setValue('ttl', 1);
  // managingEditor, webMaster, language, docs, generator

  newsCollection.find({}).forEach(function(doc) {
    self.addItem({
      title: doc.name,
      description: doc.text,
      link: 'http://mysite.meteor.com',
      pubDate: new Date()
      // title, description, link, guid, pubDate
    });
  });

});

#API

  • RssFeed.publish: function(name, handlerFunction)
  • RssFeed.unpublish: function(name) ##Internal
  • RssFeed.createTag: function(key, value)
  • RssFeed.cdataValue: function(value)
  • RssFeed.objectToXML: function(sourceObject)

#this in publish feed handler helpers

  • this.cdata: RssFeed.cdataValue
  • this.setValue: function(key, value)
  • this.addItem: function(itemObject)

About

Adds basic support for rss feed v2.0

Resources

License

Stars

Watchers

Forks

Packages

No packages published