{"id":13506559,"url":"https://github.com/nuxt-community/feed-module","last_synced_at":"2025-05-15T12:05:40.203Z","repository":{"id":31867191,"uuid":"129539032","full_name":"nuxt-community/feed-module","owner":"nuxt-community","description":"Everyone deserves RSS, ATOM and JSON feeds!","archived":false,"fork":false,"pushed_at":"2025-05-06T18:51:07.000Z","size":754,"stargazers_count":227,"open_issues_count":30,"forks_count":36,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-05-09T03:09:11.482Z","etag":null,"topics":["atom","feed","json","nuxt","nuxt-module","nuxtjs","rss"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nuxt-community.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-04-14T17:26:50.000Z","updated_at":"2025-04-23T22:07:05.000Z","dependencies_parsed_at":"2024-01-25T22:48:00.609Z","dependency_job_id":"83e10928-0838-4024-808a-f37bfca2fd59","html_url":"https://github.com/nuxt-community/feed-module","commit_stats":{"total_commits":72,"total_committers":14,"mean_commits":5.142857142857143,"dds":"0.38888888888888884","last_synced_commit":"7c8595d16bdf78bf3f5104a98252e4bd75dc4067"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuxt-community%2Ffeed-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuxt-community%2Ffeed-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuxt-community%2Ffeed-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuxt-community%2Ffeed-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nuxt-community","download_url":"https://codeload.github.com/nuxt-community/feed-module/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254337613,"owners_count":22054253,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["atom","feed","json","nuxt","nuxt-module","nuxtjs","rss"],"created_at":"2024-08-01T01:00:53.665Z","updated_at":"2025-05-15T12:05:35.184Z","avatar_url":"https://github.com/nuxt-community.png","language":"JavaScript","funding_links":[],"categories":["Uncategorized","JavaScript"],"sub_categories":["Uncategorized"],"readme":"# Feed module - Everyone deserves RSS, Atom and Json\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![Github Actions CI][github-actions-ci-src]][github-actions-ci-href] \n[![Codecov][codecov-src]][codecov-href]\n[![License][license-src]][license-href]\n\n\u003e Feed module enables everyone to have RSS, Atom and Json.\n\n[📖 **Release Notes**](./CHANGELOG.md)\n\n## Features\n\n- Three different feed types (RSS 2.0, ATOM 1.0 and JSON 1.0)\n- As many feeds as you like!\n- Completely customizable. Need to fetch data before? No problem!\n- Works with **all modes** (yes, even generate!)\n- For Nuxt 2.x and higher\n\n## Setup\n\n1. Add `@nuxtjs/feed` dependency to your project\n\n```bash\nyarn add @nuxtjs/feed # or npm install @nuxtjs/feed\n```\n\n2. Add `@nuxtjs/feed` to the `modules` section of `nuxt.config.js`\n\n```js\nexport default {\n  modules: [\n    ['@nuxtjs/feed', {\n      // Your feeds here\n    }]\n  ]\n}\n```\n\n### Using top level options\n\n```js\nexport default {\n  modules: [\n    '@nuxtjs/feed'\n  ],\n  feed: [\n    // Your feeds here\n  ]\n}\n```\n\n## Configuration\n\nSo... how to get these feeds working now?\n\n### Configuration object overview\n\n```js\nexport default {\n  feed: [\n    // A default feed configuration object\n    {\n      path: '/feed.xml', // The route to your feed.\n      async create(feed) {}, // The create function (see below)\n      cacheTime: 1000 * 60 * 15, // How long should the feed be cached\n      type: 'rss2', // Can be: rss2, atom1, json1\n      data: ['Some additional data'] // Will be passed as 2nd argument to `create` function\n    }\n  ]\n}\n```\n\n### Feed create function\n\nLet's take a closer look on the `create` function. This is the API that\nactually modifies your upcoming feed.\n\nA simple create function could look like this:\n\n```js\nimport axios from 'axios'\n\n// In your `feed` array's object:\nasync create (feed) {\n  feed.options = {\n    title: 'My blog',\n    link: 'https://lichter.io/feed.xml',\n    description: 'This is my personal feed!'\n  }\n\n  const posts = await (axios.get('https://blog-api.lichter.io/posts')).data\n  posts.forEach(post =\u003e {\n    feed.addItem({\n      title: post.title,\n      id: post.url,\n      link: post.url,\n      description: post.description,\n      content: post.content\n    })\n  })\n\n  feed.addCategory('Nuxt.js')\n\n  feed.addContributor({\n    name: 'Alexander Lichter',\n    email: 'example@lichter.io',\n    link: 'https://lichter.io/'\n  })\n}\n```\n\nFeed creation is based on the [feed](https://github.com/jpmonette/feed) package.\nPlease use it as reference and further documentation for modifying the `feed` object\nthat is passed to the `create` function.\n\nUsing the `create` function gives you almost unlimited possibilities to customize your feed!\n\n### Using a feed factory function\n\nThere is one more thing. Imagine you want to add a feed per blog category, but you don't want\nto add every category by hand.\n\nYou can use a `factory function` to solve that problem. Instead of a hardcoded array, you can setup\na function that will be called up on feed generation. The function **must** return an array with all\nfeeds you want to generate.\n\n```js\nexport default {\n  feed: async () =\u003e {\n    const posts = (await axios.get('https://blog-api.lichter.io/posts')).data\n    const tags = (await axios.get('https://blog-api.lichter.io/tags')).data\n\n    return tags.map(t =\u003e {\n      const relevantPosts = posts.filter(/*filter posts somehow*/)\n\n      return {\n        path: `/${t.slug}.xml`, // The route to your feed.\n        async create(feed) {\n          feed.options = {\n            title: `${t.name} - My blog`,\n            link: `https://blog.lichter.io/${t.slug}.xml`,\n            description: `All posts related to ${t.name} of my blog`\n          }\n\n          relevantPosts.forEach(post =\u003e {\n            feed.addItem({\n              title: post.title,\n              id: post.id,\n              link: `https://blog.lichter.io/posts/${post.slug}`,\n              description: post.excerpt,\n              content: post.text\n            })\n          })\n        },\n        cacheTime: 1000 * 60 * 15,\n        type: 'rss2'\n      }\n    })\n  }\n}\n```\n\nIn case you want to pass in data into the factory function, you can use a *factory object*.\n\n```js\nexport default {\n  feed: {\n    data: ['Your data here'],\n    factory: (dataFromFeedDotData) =\u003e {/* your factory function */}\n  }\n}\n```\n\n## Development\n\n1. Clone this repository\n2. Install dependencies using `yarn install` or `npm install`\n3. Start development server using `npm run dev`\n\n## License\n\n[MIT License](./LICENSE)\n\nCopyright (c) - Nuxt Community\n\n\u003c!-- Badges --\u003e\n[npm-version-src]: https://img.shields.io/npm/v/@nuxtjs/feed/latest.svg\n[npm-version-href]: https://npmjs.com/package/@nuxtjs/feed\n\n[npm-downloads-src]: https://img.shields.io/npm/dt/@nuxtjs/feed.svg\n[npm-downloads-href]: https://npmjs.com/package/@nuxtjs/feed\n\n[github-actions-ci-src]: https://github.com/nuxt-community/feed-module/workflows/ci/badge.svg\n[github-actions-ci-href]: https://github.com/nuxt-community/feed-module/actions?query=workflow%3Aci\n\n[codecov-src]: https://img.shields.io/codecov/c/github/nuxt-community/feed-module.svg\n[codecov-href]: https://codecov.io/gh/nuxt-community/feed-module\n\n[license-src]: https://img.shields.io/npm/l/@nuxtjs/feed.svg\n[license-href]: https://npmjs.com/package/@nuxtjs/feed\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnuxt-community%2Ffeed-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnuxt-community%2Ffeed-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnuxt-community%2Ffeed-module/lists"}