How to add an RSS feed to a static site

An RSS feed is one XML file that lists your latest posts, regenerated every time the site is built — Hugo writes it for you, Jekyll, Eleventy and Astro need one plugin, and a hand-written site needs a short script. What goes in it, how readers find it, and the validator errors you will meet first.

You publish posts on a static site and want people to follow it in a feed reader. There is no server to answer "what's new?" — only files.

That is all a feed needs. An RSS feed is one XML file at a fixed address, listing your recent posts with a title, a link and a date each. Generate it at build time, the same way your HTML is generated, publish it next to your pages, and add one <link> tag to your <head> so readers can find it. Hugo generates feeds by default; Jekyll, Eleventy and Astro each have an official plugin; on a hand-written site, a short script writes the file. A feed reader fetches that file on its own schedule and can work out what is new from each item's guid, so nothing on your side has to run when it checks.

The 30-second version

You build with How the feed is made Where it ends up
Hugo built in, nothing to install one feed each for home, sections, taxonomies and terms
Jekyll (GitHub Pages included) the jekyll-feed plugin /feed.xml, in Atom format
Eleventy @11ty/eleventy-plugin-rss /feed.xml by default, in Atom unless you set type
Astro @astrojs/rss and a rss.xml.js page /rss.xml
Hand-written HTML a script you run before publishing wherever you write it

Then, whatever the generator: one autodiscovery <link> in the <head> of your pages, absolute URLs inside the feed, and one pass through the W3C validator.

What a feed actually is

A feed is an XML document that a feed reader downloads on a schedule. The RSS 2.0 specification asks for very little. The <channel> needs three elements: title, link (the address of the site) and description. Each <item> can leave out anything else, but at least one of title or description must be present.

A minimal feed with one post:

XML
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Example notes</title>
    <link>https://example.com/</link>
    <description>Occasional notes on building things.</description>
    <atom:link href="https://example.com/feed.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>First post</title>
      <link>https://example.com/posts/first-post/</link>
      <guid isPermaLink="true">https://example.com/posts/first-post/</guid>
      <pubDate>Wed, 02 Dec 2026 00:00:00 GMT</pubDate>
      <description>One sentence that makes someone want to open it.</description>
    </item>
  </channel>
</rss>

Three elements in it carry rules that cause most of the trouble later:

RSS or Atom

Atom is the other format, standardised as RFC 4287. It is stricter: a feed and every entry must have an id, a title and an updated date, there must be an author at feed or entry level, and dates follow RFC 3339 (2026-12-02T00:00:00Z). Its media type is application/atom+xml.

Either works. Use the one your generator produces and do not hand-convert it: Jekyll's plugin writes Atom, Hugo writes RSS, Eleventy writes Atom unless you choose RSS or JSON. The choice matters far less than keeping the address stable once people subscribe.

Hugo

Hugo generates RSS feeds for the home page, sections, taxonomies and terms by default; the docs' own example links the home feed at /index.xml. By default every feed includes every page; services.rss.limit caps the number of items.

For the autodiscovery tag described below, Hugo's docs give this snippet for your head partial:

GO-HTML-TEMPLATE
{{ with .OutputFormats.Get "rss" }}
  {{ printf `<link rel=%q type=%q href=%q title=%q>` .Rel .MediaType.Type .Permalink site.Title | safeHTML }}
{{ end }}

Jekyll and GitHub Pages

The jekyll-feed plugin writes an Atom feed of your posts to /feed.xml. Add gem 'jekyll-feed' to the Gemfile, list jekyll-feed under plugins: in _config.yml, and put {% feed_meta %} in your layout's <head>, which outputs the autodiscovery tag. It includes the 10 newest posts unless you change feed: posts_limit.

It runs on GitHub Pages too: jekyll-feed is in the list of dependencies GitHub Pages builds with.

Eleventy

Install @11ty/eleventy-plugin-rss and add its feedPlugin to your config with a type (atom by default, or rss or json), an outputPath (/feed.xml by default), the collection to read and the feed's metadata. The plugin's documentation says URLs are normalised to absolute URLs pointing at your hosted domain; set metadata.base to your real address rather than leaving the example's https://example.com/.

Astro

Install @astrojs/rss and create src/pages/rss.xml.js, which exports a GET function returning rss() with a title, description, site and the items. The feed is built to /rss.xml. If you put full post HTML in each item's content, Astro's guide recommends sanitising it, and notes that relative links and images inside it are not supported.

No generator: write the file with a script

If your site is hand-written HTML, keep a list of posts somewhere and run a small script before you publish. This one is Node, with no dependencies. Save it as feed.mjs and run node feed.mjs from the folder you publish:

JS
import { writeFileSync } from "node:fs";

const site = "https://example.com";
const posts = [
  { title: "First post", path: "/posts/first-post/", date: "2026-12-02", summary: "One sentence." },
];

const esc = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");

const items = posts.map((p) => `    <item>
      <title>${esc(p.title)}</title>
      <link>${site}${p.path}</link>
      <guid isPermaLink="true">${site}${p.path}</guid>
      <pubDate>${new Date(`${p.date}T00:00:00Z`).toUTCString()}</pubDate>
      <description>${esc(p.summary)}</description>
    </item>`).join("\n");

// Write it into the folder you publish, next to index.html.
writeFileSync("feed.xml", `<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Example notes</title>
    <link>${site}/</link>
    <description>Occasional notes on building things.</description>
    <atom:link href="${site}/feed.xml" rel="self" type="application/rss+xml" />
${items}
  </channel>
</rss>
`);

toUTCString() produces the same shape as the spec's example date. The escaping matters: one bare & in a title makes the file not well-formed XML.

Drop2Run's own blog does the same inside its build script (apps/web/scripts/build-posts.mjs, read at commit 13d1fba): one item per article with a summary rather than the full text, and no lastBuildDate, because a timestamp of when the script ran would change the file on every build even when no article did.

Make the feed findable

A reader given your home page looks for an autodiscovery link. The RSS autodiscovery spec says it must sit in the <head>, with rel="alternate", type="application/rss+xml" (lowercase) and the feed's URL in href:

HTML
<link rel="alternate" type="application/rss+xml" title="Example notes" href="https://example.com/feed.xml">

For an Atom feed the type is application/atom+xml; the HTML standard says an alternate link with either type points to a syndication feed. Use a full URL — the autodiscovery spec asks publishers to, because some software ignores a <base> element — and if you have more than one feed, list the main one first.

Put the tag on every page, not only the home page. People paste whatever page they are reading into their reader.

Troubleshooting

Run the feed through the W3C Feed Validation Service, which checks RSS 2.0 and Atom. These are the messages you are most likely to see:

Undefined named entity. Your title or description contains an HTML entity such as &nbsp; or &mdash;. XML only predefines five: amp, lt, gt, apos and quot. Use the character itself, or escape HTML before putting it in the feed.

XML Parsing error. Usually a bare & or < in text. The validator itself warns to encode & and < in plain text, and the XML specification treats a well-formedness violation as a fatal error.

must be an RFC-822 date-time. A pubDate written as 2026-12-02 or in local format. Use the form above.

Missing atom:link with rel="self". Listed as a warning, not an error. The fix is to declare the Atom namespace and add the atom:link line shown above.

Links in a reader go nowhere. The feed uses relative URLs. A reader app has no page to resolve /posts/first-post/ against. Astro's guide says relative links and images inside feed content are not supported, and Eleventy's plugin normalises URLs to absolute ones for reader compatibility. Make every link, guid and href absolute.

Opening the feed in a browser does not show a list of posts. Do not use a browser as the test. Firefox dropped its built-in preview in version 64 — the release notes say RSS feed preview and live bookmarks are available only via add-ons. Test in a feed reader or the validator.

Every post shows up as new again. The guid values probably changed — you moved posts to new URLs or switched domains, and the guid was the URL. The spec lets a reader use the guid to decide whether an item is new, so a reader that does sees new items. Keep the old guid values once published; if they are no longer the post's address, mark them isPermaLink="false".

When not to add a feed

  • A site with no dated posts. A portfolio, a landing page, a product page. A feed of things that never change has nothing to tell a subscriber.
  • When you will not keep the address. A feed URL is a promise to everyone who subscribed. If you expect to move the site or rename paths without redirects, those subscribers will silently stop receiving posts.
  • Instead of an email list, if your readers do not use feed readers. A feed complements a newsletter; it does not reach the same people.

For everything else that people assume needs a server, what static actually means goes through the list.

Questions

Can a static site have an RSS feed?

Yes. The feed is a file, generated when the site is built and served like any other file. Readers download it and decide what is new themselves.

Where should the feed live?

Anywhere stable — /feed.xml, /rss.xml and Hugo's /index.xml are all common. What matters is that the address never changes and that the autodiscovery link points to it.

Does GitHub Pages support RSS?

Yes. A feed is a static file, so any host serves it, and the jekyll-feed plugin is among the plugins GitHub Pages builds with.

Should the feed contain the full post or a summary?

Either is allowed: the RSS spec says entity-encoded HTML is allowed in description. A summary is simpler and avoids broken styling and relative links in readers; full text lets people read without visiting. If you include full HTML, make every link and image URL absolute.

How many posts should the feed include?

Enough that a reader checking once a week does not miss anything. jekyll-feed defaults to 10, Hugo to all of them; ten to twenty is plenty for most blogs.

This site is the product it is written about.

Drag a folder in and read the link back. No account and no card to publish.