Publishing a small RSS 2.0 news feed
Generate the feed from the same published records used by the news page. Keep draft items out and choose a stable address for the feed itself, since readers will subscribe to that address rather than repeatedly discover it.
Build the channel and item records
Use an rss root with version="2.0" and a channel containing title, link and description. Give each item a meaningful title or description, an absolute link to its article and a stable guid. If the guid is an internal identifier rather than a URL, set isPermaLink="false". Do not create a new identifier every time the feed is rebuilt.
Write XML rather than concatenating fragments
Escape ampersands and angle brackets in text and URLs. If a description contains HTML, that markup must itself be represented safely inside the XML. Declare UTF-8 and actually emit UTF-8 bytes. A stray warning message or character before the XML declaration can make the feed unreadable, so keep application diagnostics out of the response.
Check dates and reader behaviour
RSS pubDate uses an RFC 822-style date, including a timezone, rather than the date format printed on the website. Use the article’s publication time and keep it stable across routine rebuilds. Validate the XML and subscribe in more than one reader. Test a corrected headline, a new item, an empty feed and a description containing an ampersand.
Ensure the feed response has an appropriate XML content type. Check the public URL after deployment; a valid file on disk can still be served through an error page or login screen.