{"id":19021867,"url":"https://github.com/helltraitor/nuxt-feedme","last_synced_at":"2025-04-23T07:54:50.337Z","repository":{"id":183099359,"uuid":"669609459","full_name":"helltraitor/nuxt-feedme","owner":"helltraitor","description":"The RSS feed module for Nuxt web framework","archived":false,"fork":false,"pushed_at":"2025-04-07T17:51:34.000Z","size":1277,"stargazers_count":20,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-23T07:54:45.161Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/helltraitor.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":"2023-07-22T20:54:07.000Z","updated_at":"2025-04-20T05:14:51.000Z","dependencies_parsed_at":"2025-04-07T17:32:11.046Z","dependency_job_id":"a45b4a0f-ca54-456d-84bc-4cf680459981","html_url":"https://github.com/helltraitor/nuxt-feedme","commit_stats":null,"previous_names":["helltraitor/nuxt-feedme"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helltraitor%2Fnuxt-feedme","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helltraitor%2Fnuxt-feedme/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helltraitor%2Fnuxt-feedme/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helltraitor%2Fnuxt-feedme/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/helltraitor","download_url":"https://codeload.github.com/helltraitor/nuxt-feedme/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250395200,"owners_count":21423376,"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":[],"created_at":"2024-11-08T20:23:51.520Z","updated_at":"2025-04-23T07:54:50.319Z","avatar_url":"https://github.com/helltraitor.png","language":"TypeScript","readme":"# nuxt-feedme\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![License][license-src]][license-href]\n[![Nuxt][nuxt-src]][nuxt-href]\n\nThis module provides extra abilities for implementation RSS feed.\nIt's pretty similar to [`module-feed`](https://nuxt.com/modules/module-feed),\nbut have support [`nuxt-content`](https://nuxt.com/modules/content).\n\nIf you need fully customized feeds, you can freely choose any feed module\n(this or the mentioned above). But this module can be more flexible.\n\n- [🏀 Online playground](https://stackblitz.com/github/helltraitor/nuxt-feedme?file=playground%2Fapp.vue)\n\n## Features\n\n- Configured out of the box for `nuxt-content`\n- Supports general and specialized hooks for both feed kinds\n- Flexible: use configuration defaults (feed, item), mapping (item)\n  or hooks for customization\n- SSR and SSG support\n\n### Configured out of the box for `nuxt-content`\n\nDefault settings are:\n\n```ts\n{\n  feeds: {\n    '/feed.atom': { revisit: '6h', type: 'atom1', content: true },\n    '/feed.xml': { revisit: '6h', type: 'rss2', content: true },\n    '/feed.json': { revisit: '6h', type: 'json1', content: true },\n  },\n  content: {\n    item: {\n      templateRoots: [true, 'feedme'],\n    },\n  },\n}\n```\n\n### General and specialized hooks\n\n```ts\n// project-name/server/plugins/feedme.ts\nimport type { NitroApp } from 'nitropack'\n\n// Nitro hooks can be set only in nitro plugin\nexport default (nitroApp: NitroApp) =\u003e {\n  // General hook: feedme:handle:content:item\n  // Specialized hook: feedme:handle:content:item[*]\n  //\n  // When specialized hook set, general also will be called\n  nitroApp.hooks.hook('feedme:handle:content:item[/contentDefaults.xml]', async ({ feed: { insert, invoke, parsed } }) =\u003e {\n    if (parsed.title === 'First item') {\n      // Invoke in case if item was created by another callback\n      const maybeItemOptions = invoke()\n\n      // Insert replaces current item configuration\n      insert({\n        ...maybeItemOptions,\n        category: [\n          ...maybeItemOptions?.category ?? [],\n          { name: 'content hook processed' },\n        ],\n      })\n    }\n  })\n\n  // Specialized hook for default feed\n  nitroApp.hooks.hook('feedme:handle[/feed.xml]', async ({ context: { event }, feed: { create } }) =\u003e {\n    // Create also replaces current feed\n    create({ id: '', title: `Special feed for '${event.path}' route`, copyright: '' })\n  })\n\n  // General hook for default feed\n  nitroApp.hooks.hook('feedme:handle', async ({ context: { event }, feed: { create, invoke } }) =\u003e {\n    invoke() ?? create({ id: '', title: `Default feed for '${event.path}' route`, copyright: '' })\n  })\n}\n```\n\n### Mapping configuration\n\nMapping is used for linking [`feed`](https://github.com/jpmonette/feed) item object key\nto the path in parsed content:\n\n```ts\n{\n  item: {\n    mapping: [\n      // Third item is optional mapping function\n      ['date', 'modified', value =\u003e value ? new Date(value) : value],\n      // When mapping function result is undefined - next variant applied\n      ['date', 'created', value =\u003e value ? new Date(value) : value],\n      // Until the real one value will be set\n      ['date', '', () =\u003e new Date()],\n      // By default mapping is x =\u003e x\n      ['link', '_path'],\n    ],\n    // Create default mappings with indicated roots:\n    //   [keyof Item /* such as image, id, link */, root + keyof Item]\n    //\n    // The true value means use empty root:\n    //   ['link', 'link']\n    //\n    // Where any other key means use this as path to value:\n    //  ['link', `{root}.link`]\n    //\n    // Root can be separate by `.` which allows to deep invoking\n    templateRoots: [true, 'feedme'],\n  }\n}\n```\n\n**NOTE**: Date value is a special case for `feed` module, so by default mapping provides\nthe next map for the date field: `value =\u003e value ? new Date(value) : new Date()`\nSo in case when you provide your own alias for date - you need to provide map function\n\n**NOTE**: The mapping function is serialized so its required to not to have any references in outer scopes\n\n### Tags\n\nTags allow to replace node values according to match:\n\n```ts\n{\n  // Allows to pass optional map function\n  tags: [\n    // This tags replace first empty symbol if value starts with /\n    // Example: /link -\u003e urlBase/link\n    [/^(?=\\/)/, urlBase],\n  ],\n}\n```\n\n**Note**: Tags applied recursively, item.field.inner (value) is affected\n\n## Quick Setup\n\n1. Add `nuxt-feedme` dependency to your project\n\nUse your favorite package manager (I prefer yarn)\n\n```bash\nyarn add -D nuxt-feedme\n\npnpm add -D nuxt-feedme\n\nnpm install --save-dev nuxt-feedme\n```\n\nOr install it via `nuxi module`\n\n```bash\nnpx nuxi@latest module add nuxt-feedme\n```\n\n2. Add `nuxt-feedme` to the `modules` section of `nuxt.config.ts`\n\n```js\nexport default defineNuxtConfig({\n  modules: [\n    // After nuxt content\n    '@nuxt/content',\n    'nuxt-feedme'\n  ]\n})\n```\n\nThat's it! You can now use `nuxt-feedme` in your Nuxt app ✨\n\n\u003c!-- Badges --\u003e\n[npm-version-src]: https://img.shields.io/npm/v/nuxt-feedme/latest.svg?style=flat\u0026colorA=18181B\u0026colorB=28CF8D\n[npm-version-href]: https://npmjs.com/package/nuxt-feedme\n\n[npm-downloads-src]: https://img.shields.io/npm/dm/nuxt-feedme.svg?style=flat\u0026colorA=18181B\u0026colorB=28CF8D\n[npm-downloads-href]: https://npmjs.com/package/nuxt-feedme\n\n[license-src]: https://img.shields.io/npm/l/nuxt-feedme.svg?style=flat\u0026colorA=18181B\u0026colorB=28CF8D\n[license-href]: https://npmjs.com/package/nuxt-feedme\n\n[nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?logo=nuxt.js\n[nuxt-href]: https://nuxt.com\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelltraitor%2Fnuxt-feedme","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhelltraitor%2Fnuxt-feedme","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelltraitor%2Fnuxt-feedme/lists"}