https://github.com/taga3s/rss-generator
wip
https://github.com/taga3s/rss-generator
deno rss-generator
Last synced: about 2 months ago
JSON representation
wip
- Host: GitHub
- URL: https://github.com/taga3s/rss-generator
- Owner: taga3s
- Created: 2025-02-26T23:07:22.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-27T15:32:39.000Z (over 1 year ago)
- Last Synced: 2025-02-27T20:09:11.984Z (over 1 year ago)
- Topics: deno, rss-generator
- Language: TypeScript
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# rss-generator
[](https://jsr.io/@taga3s/rss-generator)
A simple RSS 2.0 feed generator. This project is just for fun and learning
purpose, so the implementation is intentionally minimal.
## features
- Generates RSS 2.0 feed (following the
[RSS 2.0 Specification](https://www.rssboard.org/rss-specification))
- Zero dependencies
## example usage
```ts
import {
cdata,
type Channel,
generateRSS,
type Item,
} from "jsr:@taga3s/rss-generator";
const items: Item[] = [
{
title: "Example Title 1",
description: cdata("Example description"),
content: {
encoded: cdata("
Example content
"),
},
link: "https://example.com/articles/1",
atom: {
link: {
href: "https://example.com/rss.xml",
},
},
guid: {
isPermaLink: true,
value: "https://example.com/articles/1",
},
pubDate: new Date().toUTCString(),
},
{
title: "Example Title 2",
description: cdata("Example description"),
content: {
encoded: cdata("Example content
"),
},
link: "https://example.com/articles/2",
guid: {
isPermaLink: true,
value: "https://example.com/articles/2",
},
pubDate: new Date().toUTCString(),
},
];
const channel: Channel = {
title: "Example Web",
link: "https://example.com",
description: cdata("Example description"),
ttl: 60,
language: "en",
category: ["sports", "politics", "technology"],
copyright: "Example Web",
items: items,
};
if (import.meta.main) {
const xml = generateRSS({ channel });
const data = new TextEncoder().encode(xml);
await Deno.writeFile("rss.xml", data);
}
```
Generated RSS file
```xml
Example Web
https://example.com
sports
politics
technology
Example Web
en
60
Example Title 1
Example content]]>
https://example.com/articles/1
John Doe
https://example.com/articles/1
Wed, 14 Jan 2026 01:21:54 GMT
Example Title 2
Example content]]>
https://example.com/articles/2
John Doe
https://example.com/articles/2
Wed, 14 Jan 2026 01:21:54 GMT
```
> [!NOTE]
> You can validate the generated RSS file by using
> [W3C Feed Validation Service](https://validator.w3.org/feed/).
## license
[MIT](https://github.com/taga3s/rss-generator/blob/main/LICENSE)
## author
- [taga3s](https://github.com/taga3s)