Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmonette committed Aug 4, 2018
1 parent 21d367f commit f896004
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 60 deletions.
122 changes: 64 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,55 @@
# Feed for Node.js
<p align="center">
<img src="./assets/title.png" alt="Feed for Node.js" width="326">
<br>
<a href="https://travis-ci.org/jpmonette/feed"><img src="https://travis-ci.org/jpmonette/feed.svg?branch=master" alt="Build Status"></a> <a href='https://coveralls.io/github/jpmonette/feed?branch=master'><img src='https://coveralls.io/repos/github/jpmonette/feed/badge.svg?branch=master' alt='Coverage Status' /></a>
</p>

> [Feed](http://projets.jpmonette.net/en/feed) is a *RSS 2.0*, *JSON Feed 1.0*, and *Atom 1.0* generator for **Node.js**, making content syndication simple and intuitive!
[![Build Status](https://travis-ci.org/jpmonette/feed.svg?branch=master)](https://travis-ci.org/jpmonette/feed)
[![Coverage Status](https://coveralls.io/repos/github/jpmonette/feed/badge.svg?branch=master)](https://coveralls.io/github/jpmonette/feed?branch=master)
<p align="center"><code>jpmonette/feed</code> - <strong>RSS 2.0, JSON Feed 1.0, and Atom 1.0</strong> generator for <strong>Node.js</strong><br>
Making content syndication simple and intuitive!</p>

## Installation

```bash
$ npm install feed
$ yarn add feed
```

## Features

* Pure JavaScript
* Support for Atom 1.0 and RSS 2.0
* Lightweight - Only 1 dependency!
- Using TypeScript
- Support for Atom 1.0, RSS 2.0 and JSON Feed 1.0
- Fully tested using Jest

## Quick Start

First, add the module:
First and foremost, add the module:

```js
const Feed = require('feed')
import { Feed } from "feed";
```

Insert feed-specific information:

```js
let 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',
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'
generator: "awesome", // optional, default = 'Feed for Node.js'
feedLinks: {
json: 'https://example.com/json',
atom: 'https://example.com/atom',
json: "https://example.com/json",
atom: "https://example.com/atom"
},
author: {
name: 'John Doe',
email: 'johndoe@example.com',
link: 'https://example.com/johndoe'
name: "John Doe",
email: "johndoe@example.com",
link: "https://example.com/johndoe"
}
})
});
```

Insert items using the item function:
Expand All @@ -60,72 +62,76 @@ posts.forEach(post => {
link: post.url,
description: post.description,
content: post.content,
author: [{
name: 'Jane Doe',
email: 'janedoe@example.com',
link: 'https://example.com/janedoe'
}, {
name: 'Joe Smith',
email: 'joesmith@example.com',
link: 'https://example.com/joesmith'
}],
contributor: [{
name: 'Shawn Kemp',
email: 'shawnkemp@example.com',
link: 'https://example.com/shawnkemp'
}, {
name: 'Reggie Miller',
email: 'reggiemiller@example.com',
link: 'https://example.com/reggiemiller'
}],
author: [
{
name: "Jane Doe",
email: "janedoe@example.com",
link: "https://example.com/janedoe"
},
{
name: "Joe Smith",
email: "joesmith@example.com",
link: "https://example.com/joesmith"
}
],
contributor: [
{
name: "Shawn Kemp",
email: "shawnkemp@example.com",
link: "https://example.com/shawnkemp"
},
{
name: "Reggie Miller",
email: "reggiemiller@example.com",
link: "https://example.com/reggiemiller"
}
],
date: post.date,
image: post.image
})
})
});
});
```

Insert categories using:

```js
feed.addCategory('Technologie')
feed.addCategory("Technologie");
```

Insert contributors using:

```js
feed.addContributor({
name: 'Johan Cruyff',
email: 'johancruyff@example.com',
link: 'https://example.com/johancruyff'
})
name: "Johan Cruyff",
email: "johancruyff@example.com",
link: "https://example.com/johancruyff"
});
```

Output a RSS 2.0 feed:

```js
feed.rss2()
feed.rss2();
```

Output an Atom 1.0 feed:

```js
feed.atom1()
feed.atom1();
```

Output a JSON Feed 1.0 feed:

```js
feed.json1()
feed.json1();
```

Yes, it's that simple :)!

## More Information

* [Feed for Node.js](http://projets.jpmonette.net/en/feed) (English)
* [Feed pour Node.js](http://projets.jpmonette.net/feed) (French)
* Follow [@jpmonette](https://twitter.com/jpmonette) on Twitter for updates
* Read my personal blog [Blogue de Jean-Philippe Monette](http://blogue.jpmonette.net/) to learn more about what I do!
- Follow [@jpmonette](https://twitter.com/jpmonette) on Twitter for updates
- Read my personal blog [Blogue de Jean-Philippe Monette](http://blogue.jpmonette.net/) to learn more about what I do!

## License

Expand Down
Binary file added assets/title.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/__tests__/setup.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Feed from "../feed";
import { Feed } from "../feed";

const updated = new Date("Sat, 13 Jul 2013 23:00:00 GMT");
const published = new Date("Sat, 10 Jul 2013 23:00:00 GMT");
Expand Down
2 changes: 1 addition & 1 deletion src/feed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import renderAtom from "./atom1";
import renderJSON from "./json";
import renderRSS from "./rss2";

export default class Feed {
export class Feed {
options: FeedOptions;
items: Item[] = [];
categories: string[] = [];
Expand Down

0 comments on commit f896004

Please sign in to comment.