jpmonette/feed
- RSS 2.0, JSON Feed 1.0, and Atom 1.0 generator for Node.js
Making content syndication simple and intuitive!
๐ฉ๐ปโ๐ป Developer Ready: Quickly generate syndication feeds for your Website.
๐ช๐ผ Strongly Typed: Developed using TypeScript / type-safe.
๐ Tested: Tests & snapshot for each syndication format to avoid regressions.
$ yarn add feed
import { Feed } from "feed";
const feed = new Feed({
title: "Feed Title",
description: "This is my personal feed!",
id: "http://example.com/",
link: "http://example.com/",
image: "http://example.com/image.png",
favicon: "http://example.com/favicon.ico",
copyright: "All rights reserved 2013, John Doe",
updated: new Date(2013, 6, 14), // optional, default = today
generator: "awesome", // optional, default = 'Feed for Node.js'
feedLinks: {
json: "https://example.com/json",
atom: "https://example.com/atom"
},
author: {
name: "John Doe",
email: "[email protected]",
link: "https://example.com/johndoe"
}
});
posts.forEach(post => {
feed.addItem({
title: post.title,
id: post.url,
link: post.url,
description: post.description,
content: post.content,
author: [
{
name: "Jane Doe",
email: "[email protected]",
link: "https://example.com/janedoe"
},
{
name: "Joe Smith",
email: "[email protected]",
link: "https://example.com/joesmith"
}
],
contributor: [
{
name: "Shawn Kemp",
email: "[email protected]",
link: "https://example.com/shawnkemp"
},
{
name: "Reggie Miller",
email: "[email protected]",
link: "https://example.com/reggiemiller"
}
],
date: post.date,
image: post.image
});
});
feed.addCategory("Technologie");
feed.addContributor({
name: "Johan Cruyff",
email: "[email protected]",
link: "https://example.com/johancruyff"
});
console.log(feed.rss2());
// Output: RSS 2.0
console.log(feed.atom1());
// Output: Atom 1.0
console.log(feed.json1());
// Output: JSON Feed 1.0
- Follow @jpmonette on Twitter for updates
- Read my personal blog Blogue de Jean-Philippe Monette to learn more about what I do!
Copyright (C) 2013, Jean-Philippe Monette [email protected]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.