@lacspace/rss
v1.2.0
Published
Generate RSS 2.0, Atom 1.0 and JSON Feed 1.1 from one set of items — content syndication for blogs and news. Zero-dependency, isomorphic.
Maintainers
Readme
@lacspace/rss
RSS 2.0, Atom 1.0 & JSON Feed 1.1 — one item set, three formats.
Define your feed and items once; emit valid RSS 2.0, Atom 1.0 or JSON Feed 1.1. Proper escaping,
CDATAcontent, correct dates, enclosures for podcasts. Great for blogs, changelogs and news.
- 📡
rss()·atom()·jsonFeed()from the same input - 🧱 Full-content (
content:encoded), categories, authors, enclosures - 🗓️ Correct
pubDate(RFC-822) /updated(ISO-8601) handling - ⚡ Zero dependencies · 🌍 isomorphic · 📦 ESM + CJS · fully typed
Install
npm install @lacspace/rss # or pnpm add / yarn add / bun addUsage
import { rss, atom, jsonFeed } from "@lacspace/rss";
const feed = {
title: "Lacspace Blog",
link: "https://lacspace.com/blog",
description: "Product updates and engineering notes.",
feedUrl: "https://lacspace.com/rss.xml",
language: "en",
};
const items = [
{
title: "Launching the SEO Kit",
link: "https://lacspace.com/blog/seo-kit",
content: "<p>Six new packages…</p>",
author: "Lumi AI",
date: new Date("2026-08-22"),
categories: ["release"],
},
];
rss(feed, items); // RSS 2.0 XML string
atom(feed, items); // Atom 1.0 XML string
jsonFeed(feed, items); // JSON Feed 1.1 objectServe it (Next.js Route Handler)
// app/rss.xml/route.ts
import { rss } from "@lacspace/rss";
export function GET() {
return new Response(rss(feed, items), {
headers: { "Content-Type": "application/rss+xml; charset=utf-8" },
});
}Podcast enclosure
{ title: "Episode 1", link: "…", enclosure: { url: "https://…/ep1.mp3", type: "audio/mpeg", length: 12345678 } }The Lacspace SEO Kit
| Package | For |
| --- | --- |
| @lacspace/seo | Metadata & JSON-LD |
| @lacspace/sitemap | sitemap.xml |
| @lacspace/robots | robots.txt |
| @lacspace/llms-txt | llms.txt / llms-full.txt |
| @lacspace/site-verify | Search-engine verification |
| @lacspace/rss | RSS / Atom / JSON feeds (this package) |
| @lacspace/slugify | SEO URL slugs |
New in 1.1 — Response helpers
import { rssResponse, atomResponse, jsonFeedResponse } from "@lacspace/rss";
// app/feed.xml/route.ts — correct content-type, zero boilerplate
export function GET() {
return rssResponse({ title: "Blog", link: "https://x.com", description: "…" }, items);
}New in 1.2 — prefill the feed from your site
import { rss, feedForSite } from "@lacspace/rss";
// app/feed.xml/route.ts — title, link, feedUrl and language auto-filled
export function GET() {
return new Response(rss(feedForSite({ name: "Acme Blog", url: "https://acme.com" }, "/feed.xml"), posts), {
headers: { "content-type": "application/rss+xml" },
});
}Pairs with defineSite() from @lacspace/seo — feedForSite(site.config).
Licensing
This package is free under the Lacspace Free Licence — MIT-equivalent freedoms. Use it in personal and commercial projects at no cost; just keep the notice.
Not every Lacspace package is free. We also offer Commercial (paid), Client-specific, and Private (proprietary) packages under separate terms. See the full Lacspace Licence Centre.
Part of the Lacspace ecosystem — 35 zero-dependency, isomorphic TypeScript packages.
