Static site generators are good at feeds because a feed is just one more file built from the same list of posts. Most of them either produce one out of the box or need a single official plugin. The work that remains is the part the generators do not do for you: absolute links, sensible dates, a tag in the page head so people can find the feed, and a server that labels the file correctly.
Below is the setup for the common generators, then a hand-written template for everything else, then the three checks that apply to all of them.
Hugo
Hugo builds RSS feeds without being asked. The home page gets /index.xml, and so does every section and taxonomy term, so a blog in content/posts/ also has /posts/index.xml and a tag called "go" has /tags/go/index.xml. The Hugo News feed is a real example of the default output.
By default the feed has no item limit, which on an old blog means hundreds of items in one file. Set one in the site configuration:
# hugo.toml
[services.rss]
limit = 20
Older Hugo versions used a top-level rssLimit setting for the same thing. The built-in template puts the post summary in each item's description. If you want full text, override the RSS template in your layouts folder; the Hugo documentation on RSS templates shows the embedded one you can copy as a starting point.
Many themes already print the autodiscovery tag. If yours does not, add this to the head partial:
{{ with .OutputFormats.Get "rss" -}}
{{ printf `<link rel=%q type=%q href=%q title=%q>` .Rel .MediaType.Type .Permalink site.Title | safeHTML }}
{{ end }}
Jekyll
Jekyll uses the official jekyll-feed plugin, which GitHub Pages also supports. Add it to the Gemfile:
group :jekyll_plugins do
gem "jekyll-feed"
end
and to _config.yml:
url: "https://example.com"
plugins:
- jekyll-feed
feed:
posts_limit: 20
The plugin writes an Atom feed (not RSS 2.0) to /feed.xml. Atom is supported by every feed reader, so this is fine; the Atom vs RSS comparison covers the differences if you are curious. Set url correctly: the plugin builds absolute addresses from it, and a missing value produces links that point nowhere.
For the autodiscovery tag, put {% feed_meta %} in the head of your layout. The plugin expands it into the right link element.
Eleventy
Eleventy has an official plugin, @11ty/eleventy-plugin-rss. Version 2 of the plugin can generate the whole feed from a configuration block, with no template file:
// eleventy.config.js
import { feedPlugin } from "@11ty/eleventy-plugin-rss";
export default function (eleventyConfig) {
eleventyConfig.addPlugin(feedPlugin, {
type: "rss", // or "atom", "json"
outputPath: "/feed.xml",
collection: { name: "posts", limit: 20 },
metadata: {
language: "en",
title: "Example Blog",
subtitle: "Notes on building things.",
base: "https://example.com/",
author: { name: "Jane Doe" },
},
});
}
collection.name must match the tag your posts carry. If you prefer to write the template yourself, the same plugin provides filters such as absoluteUrl and dateToRfc822, which handle the two things hand-written feeds most often get wrong. The Eleventy blog publishes its own feed if you want to compare output.
Astro
Astro's official package is @astrojs/rss. Install it, set site in astro.config.mjs, and create an endpoint:
// src/pages/rss.xml.js
import rss from "@astrojs/rss";
import { getCollection } from "astro:content";
export async function GET(context) {
const posts = await getCollection("blog");
return rss({
title: "Example Blog",
description: "Notes on building things.",
site: context.site,
items: posts.map((post) => ({
title: post.data.title,
pubDate: post.data.pubDate,
description: post.data.description,
link: `/blog/${post.id}/`,
})),
});
}
The file name decides the address, so this one is served at /rss.xml. The helper turns the relative link values into absolute ones using site, which is why site must be set. Sort the posts newest first before mapping them if your collection does not come back in that order.
Next.js and other frameworks
Next.js has no feed generator built in. With the App Router, a route handler at app/feed.xml/route.js can build the XML string from your posts and return it with a Content-Type header. With a fully static export, generate the file in a build script and write it to public/. Either way you are writing the template yourself, which is the next section.
A hand-written RSS 2.0 template
If your generator has nothing, or you want full control, this is everything a feed needs:
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Example Blog</title>
<link>https://example.com/</link>
<description>Notes on building things.</description>
<language>en</language>
<atom:link href="https://example.com/feed.xml" rel="self" type="application/rss+xml"/>
<item>
<title>Moving the blog to a static site</title>
<link>https://example.com/posts/static-move/</link>
<guid isPermaLink="true">https://example.com/posts/static-move/</guid>
<pubDate>Wed, 25 Nov 2026 08:00:00 GMT</pubDate>
<description>Why we left the old CMS and what broke on the way.</description>
</item>
</channel>
</rss>
Four details matter more than the rest.
- The date must be in RFC 822 form. In JavaScript,
new Date(post.date).toUTCString()produces exactly that. A date like2026-11-25is valid in Atom but wrong in RSS. - Every title and description must be escaped. An
&in a post title will otherwise break the whole feed. Use your template engine's XML or HTML escaping, or wrap HTML content in a CDATA section. - Every address must be absolute, including links and images inside the description.
- The
guidmust never change once published. The post address works if your addresses are permanent.
If you want to include the full HTML of each post, add the content namespace (xmlns:content="http://purl.org/rss/1.0/modules/content/") and put the HTML in content:encoded, keeping description as a short summary.
Make the feed discoverable
Whatever generated the feed, every page should announce it in the head:
<link rel="alternate" type="application/rss+xml" title="Example Blog" href="https://example.com/feed.xml">
Use application/atom+xml for an Atom feed. Feed readers and tools like our feed finder look for this tag first. In our crawl of 5,518 sites it was the way 1,448 feeds were found; without it, finders fall back to guessing paths, and a feed at /rss.xml or /index.xml may never be guessed.
Serve it with the right Content-Type
Static hosts pick the content type from the file extension, and .xml usually comes out as application/xml or text/xml. Readers accept both. If you want the specific type, Cloudflare Pages and Netlify both read a _headers file at the root of the output folder:
/feed.xml
Content-Type: application/rss+xml; charset=utf-8
Avoid naming the feed without an extension, such as /feed, on a static host. The file is then often served as application/octet-stream or as a download, which some readers reject. Our crawl found 62 feeds served as text/html, mostly for that kind of reason.
Check it after every deploy
Paste the feed address into the checker after the first deploy. Static feeds fail in predictable ways: an empty url or site setting that leaves every link relative, a template change that drops the guid, or a date in the wrong format. The list of common RSS errors covers the encoding and date cases in detail. Once the feed is clean, submit it to the directory so people browsing blogs and personal sites can find it.