4.2.2 • Published 3 years ago

feed v4.2.2

Weekly downloads
83,339
License
MIT
Repository
github
Last release
3 years ago

👩🏻‍💻 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.

Getting Started

Installation

$ yarn add feed

Example

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/",
  language: "en", // optional, used only in RSS 2.0, possible values: http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
  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: "johndoe@example.com",
    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: "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
  });
});

feed.addCategory("Technologie");

feed.addContributor({
  name: "Johan Cruyff",
  email: "johancruyff@example.com",
  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

Migrating from < 3.0.0

If you are migrating from a version older than 3.0.0, be sure to update your import as we migrated to ES6 named imports.

If your environment supports the ES6 module syntax, you can import as described above:

import { Feed } from "feed";

Otherwise, you can stick with require():

- const Feed = require('feed');
+ const Feed = require('feed').Feed;

More Information

License

Copyright (C) 2013, Jean-Philippe Monette contact@jpmonette.net

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.

@mdn/yari@docusaurus-azuread/plugin-content-blog@cfchase/interactive-landscapenuxt-feed-modulehahnbee-testhahnbee-test-client@mitjafelicijan/staticgen@everything-registry/sub-chunk-1656@chrishannah/bulba@lando/vitepress-theme-default-plus@lancom/feed@mark-magic/plugin-docs@lingpoint/core@makerdao/docusaurus@lfnetworking/interactive-landscape@kaciras-blog/server@ironfly/nuts@islands/feedd3-fluid@jaybeeuu/feed-webpack-plugin@jcamp/vitepress-blog-themenuxt-module-feednuxt-feednuxt-feedme@microflash/gridsome-plugin-feed@unboundedsystems/docusaurusgrunt-blogbuilder@totemorg/debe@totemstan/debeisk.jstwitter-rss-noauthtwitter-rss-feed@u-blox/feed-builder-gatsbyjoplin-plugin-pages-publisherrss-twitter@netdata/interactive-landscape@notiz/scully-plugin-rss@netless/docusaurus@nuxtjs/feed@nullfox/nextjs-blog@nuxt-mycelium/theme@osmoscraft/osmosfeedeziosupressvalaxy@walkaway-project/elmstaticvue-browser-detect-pluginkizz-theme-papervideofeedupwrite@wepublish/websitevitepress-theme-sakuravitepress-plugin-rssvuepress-plugin-feedleeguoo-docaidleblog@zadkiel/gulp-feedwebpack-feed-pluginacha-frameworkackee-reporthyperfeedhyxa@the-darc/docusaurusinteractive-landscapeinteractive-landscape-cagiptfbjs@terrymooreii/siaunlimited-blog-works@uselessdev/next-rss@we2rss/corekunta-api-www-mantyharjumarkdown-rss-feed-pluginmarkdown-rss-generator-webpack-plugin@pushrocks/smartfeed@push.rocks/smartfeedsoundon-apiginb@sairinjs/coregridsome-plugin-feedgoldwasherelmstatic@naari3/osmosfeedscraper-utilsscraper-utils2@prrashi/nutsfreezegatsby-plugin-feed-generator@storipress/karbon@stormbuf/vuepress-plugin-rsssmolpress@rmp135/twitch-rssgitbook-plugin-mysitegitbook-plugin-feedsquido@rea-app/docusaurus@starzkg/vuepress-plugin-feed@statusfy/coreheadlinebotsaber-plugin-feedsaber-plugin-generate-feed
4.2.2

3 years ago

4.2.1

4 years ago

4.2.0

4 years ago

4.1.0

4 years ago

4.0.0

5 years ago

3.0.0

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.1.1

6 years ago

1.1.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.3.1

7 years ago

0.3.0

8 years ago

0.2.6

10 years ago

0.2.5

11 years ago

0.2.4

11 years ago

0.2.3

11 years ago

0.2.2

11 years ago

0.2.1

11 years ago

0.2.0

11 years ago

0.1.4

11 years ago

0.1.3

11 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago