All Projects → nuxt-community → Feed Module

nuxt-community / Feed Module

Licence: mit
Everyone deserves RSS, ATOM and JSON feeds!

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Feed Module

Feedparser
feedparser gem - (universal) web feed parser and normalizer (XML w/ Atom or RSS, JSON Feed, HTML w/ Microformats e.g. h-entry/h-feed or Feed.HTML, Feed.TXT w/ YAML, JSON or INI & Markdown, etc.)
Stars: ✭ 156 (-14.29%)
Mutual labels:  rss, json, atom, feed
Miniflux Legacy
Minimalist RSS reader (version 1.x)
Stars: ✭ 897 (+392.86%)
Mutual labels:  rss, atom, feed
Feed
A RSS, Atom and JSON Feed generator for Node.js, making content syndication simple and intuitive! 🚀
Stars: ✭ 523 (+187.36%)
Mutual labels:  rss, atom, feed
Atoma
Atom, RSS and JSON feed parser for Python 3
Stars: ✭ 67 (-63.19%)
Mutual labels:  rss, atom, feed
Picofeed
PHP library to parse and write RSS/Atom feeds
Stars: ✭ 439 (+141.21%)
Mutual labels:  rss, atom, feed
Jquery Rss
An easy-to-use rss plugin for jquery with templating.
Stars: ✭ 443 (+143.41%)
Mutual labels:  rss, atom, feed
Liferea
Liferea (Linux Feed Reader), a news reader for GTK/GNOME
Stars: ✭ 612 (+236.26%)
Mutual labels:  rss, atom, feed
Rss Atom Bundle
RSS and Atom Bundle for Symfony
Stars: ✭ 123 (-32.42%)
Mutual labels:  rss, atom, feed
Feedbag
Ruby's favorite feed auto-discovery library/tool
Stars: ✭ 115 (-36.81%)
Mutual labels:  rss, atom, feed
Feedparser
Parse feeds in Python
Stars: ✭ 1,200 (+559.34%)
Mutual labels:  rss, json, atom
Hexo Generator Feed
Feed generator for Hexo.
Stars: ✭ 400 (+119.78%)
Mutual labels:  rss, atom, feed
Posidonlauncher
a one-page homescreen with a news feed
Stars: ✭ 163 (-10.44%)
Mutual labels:  rss, atom, feed
Reader
Free and open source feeds reader, including all major Google Reader features
Stars: ✭ 347 (+90.66%)
Mutual labels:  rss, atom, feed
Python Feedgen
Python module to generate ATOM feeds, RSS feeds and Podcasts.
Stars: ✭ 501 (+175.27%)
Mutual labels:  rss, atom, feed
buran
Bidirectional, data-driven RSS/Atom feed consumer, producer and feeds aggregator
Stars: ✭ 27 (-85.16%)
Mutual labels:  atom, rss, feed
feeds-to-pocket
Sends entries from RSS and Atom feeds to Pocket (https://getpocket.com)
Stars: ✭ 24 (-86.81%)
Mutual labels:  atom, rss, feed
meta-extractor
Super simple and fast html page meta data extractor with low memory footprint
Stars: ✭ 38 (-79.12%)
Mutual labels:  atom, rss, feed
baRSS
Menu Bar RSS reader for macOS
Stars: ✭ 39 (-78.57%)
Mutual labels:  atom, rss, feed
Discord feedbot
Moved to https://gitlab.com/ffreiheit/discord_feedbot
Stars: ✭ 67 (-63.19%)
Mutual labels:  rss, atom, feed
Gofeed
Parse RSS, Atom and JSON feeds in Go
Stars: ✭ 1,762 (+868.13%)
Mutual labels:  rss, atom, feed

Feed module - Everyone deserves RSS, Atom and Json

npm version npm downloads Github Actions CI Codecov License

Feed module enables everyone to have RSS, Atom and Json.

📖 Release Notes

Features

  • Three different feed types (RSS 2.0, ATOM 1.0 and JSON 1.0)
  • As many feeds as you like!
  • Completely customizable. Need to fetch data before? No problem!
  • Works with all modes (yes, even generate!)
  • For Nuxt 2.x and higher

Setup

  1. Add @nuxtjs/feed dependency to your project
yarn add @nuxtjs/feed # or npm install @nuxtjs/feed
  1. Add @nuxtjs/feed to the modules section of nuxt.config.js
export default {
  modules: [
    ['@nuxtjs/feed', {
      // Your feeds here
    }]
  ]
}

Using top level options

export default {
  modules: [
    '@nuxtjs/feed'
  ],
  feed: [
    // Your feeds here
  ]
}

Configuration

So... how to get these feeds working now?

Configuration object overview

export default {
  feed: [
    // A default feed configuration object
    {
      path: '/feed.xml', // The route to your feed.
      async create(feed) {}, // The create function (see below)
      cacheTime: 1000 * 60 * 15, // How long should the feed be cached
      type: 'rss2', // Can be: rss2, atom1, json1
      data: ['Some additional data'] // Will be passed as 2nd argument to `create` function
    }
  ]
}

Feed create function

Let's take a closer look on the create function. This is the API that actually modifies your upcoming feed.

A simple create function could look like this:

import axios from 'axios'

// In your `feed` array's object:
async create (feed) {
  feed.options = {
    title: 'My blog',
    link: 'https://lichter.io/feed.xml',
    description: 'This is my personal feed!'
  }

  const posts = await (axios.get('https://blog-api.lichter.io/posts')).data
  posts.forEach(post => {
    feed.addItem({
      title: post.title,
      id: post.url,
      link: post.url,
      description: post.description,
      content: post.content
    })
  })

  feed.addCategory('Nuxt.js')

  feed.addContributor({
    name: 'Alexander Lichter',
    email: '[email protected]',
    link: 'https://lichter.io/'
  })
}

Feed creation is based on the feed package. Please use it as reference and further documentation for modifying the feed object that is passed to the create function.

Using the create function gives you almost unlimited possibilities to customize your feed!

Using a feed factory function

There is one more thing. Imagine you want to add a feed per blog category, but you don't want to add every category by hand.

You can use a factory function to solve that problem. Instead of a hardcoded array, you can setup a function that will be called up on feed generation. The function must return an array with all feeds you want to generate.

export default {
  feed: async () => {
    const posts = (await axios.get('https://blog-api.lichter.io/posts')).data
    const tags = (await axios.get('https://blog-api.lichter.io/tags')).data

    return tags.map(t => {
      const relevantPosts = posts.filter(/*filter posts somehow*/)

      return {
        path: `/${t.slug}.xml`, // The route to your feed.
        async create(feed) {
          feed.options = {
            title: `${t.name} - My blog`,
            link: `https://blog.lichter.io/${t.slug}.xml`,
            description: `All posts related to ${t.name} of my blog`
          }

          relevantPosts.forEach(post => {
            feed.addItem({
              title: post.title,
              id: post.id,
              link: `https://blog.lichter.io/posts/${post.slug}`,
              description: post.excerpt,
              content: post.text
            })
          })
        },
        cacheTime: 1000 * 60 * 15,
        type: 'rss2'
      }
    })
  }
}

In case you want to pass in data into the factory function, you can use a factory object.

export default {
  feed: {
    data: ['Your data here'],
    factory: (dataFromFeedDotData) => {/* your factory function */}
  }
}

Development

  1. Clone this repository
  2. Install dependencies using yarn install or npm install
  3. Start development server using npm run dev

License

MIT License

Copyright (c) - Nuxt Community

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].