Sub topic 11
Offering an RSS Feed
RSS is an XML format that lists your newest posts so that software can check for them automatically. This chapter shows how to build a feed for the newsroom, publish it where tools can find it, and avoid the errors that cause duplicate or missing items.
It assumes you can read basic HTML and XML, know what a press release is, and understand URLs and file hosting. It also assumes your releases already have stable URLs, as set up in the chapters on newsroom structure and publishing releases.
Why a newsroom needs a feed
A feed is a pull mechanism. A subscriber's software requests your feed file on a schedule and shows whatever is new. Journalists get releases in the reader they already use, without joining a mailing list. Media-monitoring tools, Slack integrations, and automation services also read feeds, and you never have to know they exist.
For you, the cost is one extra file that regenerates whenever you publish. There is no subscriber database and no consent flow to manage.
Anatomy of an RSS 2.0 feed
A feed has one rss root, one channel that describes the newsroom, and one item per release.
| Element | Level | Required | Purpose |
|---|---|---|---|
| `title` | channel | Yes | Name shown in the reader |
| `link` | channel | Yes | URL of the newsroom page |
| `description` | channel | Yes | One-sentence summary of the feed |
| `lastBuildDate` | channel | No | When the feed file last changed |
| `title` or `description` | item | At least one | Headline and summary |
| `link` | item | No, but include it | Canonical URL of the release |
| `guid` | item | No, but include it | Permanent identifier |
| `pubDate` | item | No, but include it | Publication time |
Here is a complete feed with two items. It adds a self-referencing atom:link, which validators recommend because it tells readers the feed's own address.
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Acme Newsroom</title>
<link>https://example.com/newsroom</link>
<description>Press releases and news from Acme.</description>
<language>en-us</language>
<lastBuildDate>Thu, 12 Mar 2026 09:00:00 GMT</lastBuildDate>
<atom:link href="https://example.com/newsroom/feed.xml" rel="self" type="application/rss+xml"/>
<item>
<title>Acme launches Widget 2</title>
<link>https://example.com/newsroom/acme-launches-widget-2</link>
<guid isPermaLink="true">https://example.com/newsroom/acme-launches-widget-2</guid>
<pubDate>Thu, 12 Mar 2026 09:00:00 GMT</pubDate>
<description>Widget 2 cuts setup time for small teams.</description>
</item>
<item>
<title>Acme opens Lisbon office</title>
<link>https://example.com/newsroom/acme-opens-lisbon-office</link>
<guid isPermaLink="true">https://example.com/newsroom/acme-opens-lisbon-office</guid>
<pubDate>Mon, 02 Feb 2026 14:30:00 GMT</pubDate>
<description>Acme & its partners add a European support hub.</description>
</item>
</channel>
</rss>Note the & in the second description. XML treats a bare & or < as syntax, so a headline such as "Acme & Partners" will make the whole feed unparseable unless you escape it.
The details that cause most problems
Identifiers: `guid`
Readers decide whether an item is new by comparing its guid to ones they have already seen. If the guid changes, every subscriber sees a duplicate. Using the release's canonical URL works well because you already treat that URL as permanent. Set isPermaLink="true" only when the value really is a URL that resolves. If you use another scheme, such as a database ID, set isPermaLink="false".
Dates: `pubDate`
RSS 2.0 dates follow the RFC 822 style, for example Thu, 12 Mar 2026 09:00:00 GMT. Common mistakes are using ISO 8601 (2026-03-12T09:00:00Z, which belongs in JSON-LD), writing a weekday that does not match the date, and omitting the time zone. Generate dates with a library and do not type them by hand.
Absolute URLs and content
Feed readers show your items outside your site, so a relative link like /newsroom/post points nowhere. Use full https:// URLs in every link, guid, and image reference.
For description, choose between a short summary and the full release body. A summary keeps the feed small and sends readers to your page, where your assets and contact block live. The full body is more convenient for monitoring tools. If you include HTML, wrap it in <content:encoded> with CDATA, which needs the namespace xmlns:content="http://purl.org/rss/1.0/modules/content/". A plain-text description is the safer default for a press feed.
Attachments
To attach a file such as a lead image, add <enclosure url="https://example.com/img/widget-2-1200x630.jpg" length="184320" type="image/jpeg"/>. All three attributes are required, and length is the file size in bytes. A wrong length is tolerated by most readers, but a missing one fails validation.
Generating the feed from your release data
Writing XML by hand does not scale past a few releases. Generate the file from the same data that builds your release pages, so the two cannot drift apart. This Python script (3.9 or later, standard library only) builds the feed and relies on ElementTree to escape special characters.
from datetime import datetime, timezone
from email.utils import format_datetime
import xml.etree.ElementTree as ET
BASE = "https://example.com"
ATOM_NS = "http://www.w3.org/2005/Atom"
ET.register_namespace("atom", ATOM_NS)
releases = [
{
"slug": "acme-launches-widget-2",
"title": "Acme launches Widget 2",
"summary": "Widget 2 cuts setup time for small teams.",
"published": datetime(2026, 3, 12, 9, 0, tzinfo=timezone.utc),
},
{
"slug": "acme-opens-lisbon-office",
"title": "Acme opens Lisbon office",
"summary": "Acme & its partners add a European support hub.",
"published": datetime(2026, 2, 2, 14, 30, tzinfo=timezone.utc),
},
]
def build_feed(items, limit=25):
ordered = sorted(items, key=lambda r: r["published"], reverse=True)[:limit]
rss = ET.Element("rss", {"version": "2.0"})
channel = ET.SubElement(rss, "channel")
ET.SubElement(channel, "title").text = "Acme Newsroom"
ET.SubElement(channel, "link").text = f"{BASE}/newsroom"
ET.SubElement(channel, "description").text = "Press releases and news from Acme."
ET.SubElement(channel, "language").text = "en-us"
ET.SubElement(channel, "lastBuildDate").text = format_datetime(
ordered[0]["published"], usegmt=True
)
ET.SubElement(
channel,
f"{{{ATOM_NS}}}link",
{"href": f"{BASE}/newsroom/feed.xml", "rel": "self", "type": "application/rss+xml"},
)
for release in ordered:
url = f"{BASE}/newsroom/{release['slug']}"
item = ET.SubElement(channel, "item")
ET.SubElement(item, "title").text = release["title"]
ET.SubElement(item, "link").text = url
ET.SubElement(item, "guid", {"isPermaLink": "true"}).text = url
ET.SubElement(item, "pubDate").text = format_datetime(
release["published"], usegmt=True
)
ET.SubElement(item, "description").text = release["summary"]
tree = ET.ElementTree(rss)
ET.indent(tree)
return tree
if __name__ == "__main__":
build_feed(releases).write("feed.xml", encoding="utf-8", xml_declaration=True)
print("Wrote feed.xml")Run it as part of the same build step that publishes a release. The limit argument keeps the file to the newest 25 items, which is enough for readers and keeps the download small.
Making the feed discoverable
A feed nobody can find does not help. Do both of the following.
- Add a
linkelement withrel="alternate"to theheadof the newsroom index and of each release page. Browsers and feed readers use it for autodiscovery. - Add a visible "RSS" link in the page body, since many people never look at the
head.
<link rel="alternate" type="application/rss+xml" title="Acme Newsroom" href="/newsroom/feed.xml">
<p><a href="/newsroom/feed.xml">Subscribe via RSS</a></p>Serve the file with the header Content-Type: application/rss+xml; charset=utf-8. application/xml also works. A server that returns text/html for the file is a frequent cause of "not a valid feed" errors. Do not list feed.xml in your sitemap, because the sitemap is for pages, not feeds.
Embargoes and updates
If you correct a typo in a published release, update the item's text and leave guid and pubDate unchanged. Most readers will not show it as new. Remove an item only when the release itself is withdrawn.
Testing the feed
Check these things after every change to the generator:
- Run
xmllint --noout feed.xmlto confirm the XML is well formed. - Request the live URL with
curl -I https://example.com/newsroom/feed.xmland confirm a200status and the rightContent-Type. - Paste the URL into the W3C Feed Validation Service, which reports date, guid, and namespace problems.
- Subscribe in a real feed reader and check that titles, links, and dates look right.
| Symptom | Likely cause | Fix |
|---|---|---|
| Reader says the feed is invalid | Unescaped `&` or `<` | Generate XML with a library, or escape the characters |
| Every item reappears as new | `guid` changed | Restore the original guid values |
| Items sort in the wrong order | Dates not in RFC 822 or wrong time zone | Format with a date library, always in GMT |
| Links open a 404 | Relative URLs | Use absolute `https://` URLs |
| Old content after publishing | Server or CDN caching | Purge the cache or shorten the feed's cache time |
Exercise
Your build script produces a feed where each item's guid is the release's database ID, and the release page URL is the link. A teammate sets isPermaLink="true" on the guid. What problem can this cause, and what is the correct setting?
Show answer
With isPermaLink="true", readers treat the guid as a URL that should resolve, and some will try to open it or display it as the link. A database ID is not a URL, so it breaks. The correct setting is isPermaLink="false" (or a guid that is the real permanent URL). The guid must also never change, or subscribers will see duplicates.
Exercise
A release title is "Acme & Partners expand to Berlin". Hand-written XML contains <title>Acme & Partners expand to Berlin</title> and every reader rejects the feed. Why, and how do you fix it?
Show answer
The bare & starts an XML entity, so the document is not well formed. Escape it as & (<title>Acme & Partners expand to Berlin</title>), or generate the feed with an XML library that escapes text for you.