Skip to content

RSS / Atom feed

Generate a static feed.xml for blogs, changelogs, and magazine-style sites.

PreactPress can generate a static feed.xml during production builds. The feed uses the Atom XML format and is suitable for RSS readers.

Enable the feed#

Set site.url and enable build.feed in .preactpress/config.ts:

import { defineConfig } from "@kamod-ch/preactpress/config";

export default defineConfig({
  site: {
    title: "Acme Blog",
    description: "Product updates and engineering notes",
    url: "https://example.com",
  },

  build: {
    feed: { limit: 20 },
  },
});

After running a production build, PreactPress writes:

dist/feed.xml

Add page metadata#

Feed entries use each page’s title, description, route, and lastUpdated value.

---
title: Launch notes
description: What shipped in our first public release.
lastUpdated: 2026-07-01T10:00:00.000Z
tags:
  - changelog
---

We shipped the first public version today.

Build and inspect#

pnpm run build

Then open or publish:

https://example.com/feed.xml

You can expose the feed to browsers and feed readers with transformHead:

import { defineConfig } from "@kamod-ch/preactpress/config";

export default defineConfig({
  site: {
    title: "Acme Blog",
    description: "Product updates and engineering notes",
    url: "https://example.com",
  },

  build: {
    feed: { limit: 20 },
  },

  transformHead() {
    return [
      [
        "link",
        {
          rel: "alternate",
          type: "application/atom+xml",
          title: "Acme Blog feed",
          href: "/feed.xml",
        },
      ],
    ];
  },
});

Notes#

  • Feed generation requires site.url.
  • Draft pages are excluded from production output and therefore from the feed.
  • build.feed: true includes all pages.
  • build.feed: { limit: 20 } keeps only the newest entries.
Last updated Jul 29, 2026