Content Syndication with Node.js



Source :

Web syndication is a must for any Website wishing to share some entries easily to other systems. Better known under their format name like RSS) or Atom), they can be quite time consuming to generate without a module handling all their formating. Thanks to the power of Node’s package manager NPM, you can generate yours in no time.

Installing the feed wrapper

Before we start, head to your project folder and install the latest version of the module feed:

$ npm install feed

Building the feed

First, we need to initialize a new Feed object. When you initialize the object, you must provide general information related to your Web syndication feed.

var feed = new Feed({
 title: 'My Feed Title',
 description: 'This is my personnal feed!',
 link: '',
 image: '',
 copyright: 'Copyright © 2013 John Doe. All rights reserved',

author: {
 name: 'John Doe',
 email: '',
 link: ''

Second, you might want to identify your feed thematic. Both RSS) and Atom) formats offer the possibility to identify one or multiple categories. Again, this is super simple to add:


This is the implicit way of calling the render request. By default, it will render a RSS) feed. You an also use the explicit way, allowing you to select between RSS) or Atom):

res.set('Content-Type', 'text/xml');

Here is the result.

<rss version="2.0">

<title>My Feed Title</title>
<description>This is my personnal feed!</description>
<author> (John Doe)</author>
<lastBuildDate>Tue, 31 Dec 2013 08:37:55 GMT</lastBuildDate>
<copyright>Copyright © 2013 John Doe. All rights reserved</copyright><generator>Feed for Node.js</generator>


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s