A lightweight, zero-dependency TypeScript library for generating RSS 2.0, Atom 1.0, and JSON Feed 1.1 syndication feeds. Built for projects that prioritize clarity, maintainability, and privacy-conscious tooling. Whether you're building a blog, newsletter, or publishing platform, this library helps you publish well-formed feeds without bloat.
import
, require
, and browser <script>
tagsType | Url |
---|---|
RSS | https://undercroftlabs.com/feed.xml |
Atom | https://undercroftlabs.com/feed.atom |
Json | https://undercroftlabs.com/feed.json |
Metric | Value |
---|---|
Bundle size | 5.5 kB |
Minified + Gzipped | 1.9 kB |
Download time | ~2 ms (Slow 3G) |
Install via your preferred package manager:
$ npm install @undercroft/syndication
Or load it from one of the available CDNs:
CDN | Link | Copy |
---|---|---|
jsDelivr | https://cdn.jsdelivr.net/npm/@undercroft/timespan/dist/index.umd.js | |
unpkg | https://unpkg.com/@undercroft/timespan/dist/index.umd.js | |
Skypack | https://cdn.skypack.dev/@undercroft/timespan | |
esm.sh | https://esm.sh/@undercroft/timespan | |
jspm | https://jspm.dev/@undercroft/timespan | |
esm.run | https://esm.run/@undercroft/timespan |
import { RssFeed } from '@undercroft/syndication';
const metadata = {
title: 'Undercroft Labs',
description: 'Tiny tools. Big ideas.',
url: 'https://undercroftlabs.com',
id: 'https://undercroftlabs.com/feed',
author: 'Michael Goodwin',
};
const items = [
{
id: 'welcome',
title: 'Welcome to Undercroft',
url: 'https://undercroftlabs.com/posts/welcome',
description: 'The first post.',
published: '2025-04-20T00:00:00Z',
},
];
const feed = new RssFeed(metadata, items);
const xml = feed.render();
console.log(xml);
<script src="https://cdn.jsdelivr.net/npm/@undercroft/syndication/dist/index.umd.js"></script>
<script>
const feed = new Syndication.JsonFeed({
title: 'Undercroft Labs',
id: 'https://undercroftlabs.com/feed',
url: 'https://undercroftlabs.com',
description: 'Tiny tools. Big ideas.',
author: 'Michael Goodwin',
}, [{
id: 'welcome',
title: 'Welcome to Undercroft',
url: 'https://undercroftlabs.com/posts/welcome',
description: 'The first post.',
published: '2025-04-20T00:00:00Z',
}]);
console.log(feed.render());
</script>
You can create and render feeds.
const feed = new RssFeed(metadata, items)
feed.render()
You can also dynamically add items:
feed.addItem({
id: 'post-2',
title: 'Another Post',
url: 'https://site.com/posts/2',
published: '2025-04-21T00:00:00Z',
});
const feed = new RssFeed(metadata, items)
feed.addItem({
id: 'post-2',
title: 'Another Post',
url: 'https://site.com/posts/2',
published: '2025-04-21T00:00:00Z',
});
feed.render()
Contributions are welcome! Feel free to open issues or submit pull requests on the GitHub repository.
Timespan is open source under the MIT License.