Simple Website Framework

The RSS Feed

Thursday October 22nd, 2026

Written by Scary le Poo

The framework generates RSS 2.0 feeds from the posts in pages/posts/: one feed for the whole site and one for every category that exists. Nothing to configure; a feed is there as soon as you have a post, and a category feed appears the moment a post is tagged with a new category. The feeds are generated on each request and never cached, so they are always current.


The Feeds

https://example.com/?rss                        → all posts
https://example.com/?rss=tutorials              → one category
https://example.com/?rss=design,engineering     → posts in either category
https://example.com/?rss=uncategorized          → posts with no category tag

A post belongs to the categories in its pagecategory tag (see Posts, Categories & Filtering); an untagged post is "uncategorized". A category feed includes a post if it is in any of the listed categories, and its channel title carries the category name ("My Site – Tutorials") so subscribers can tell their feeds apart. A category nobody has used yet gives a valid, empty feed.


Letting People Find the Feeds

Browsers no longer show a feed button, but the thing it relied on still works: every page's <head> carries a <link rel="alternate" type="application/rss+xml"> for each feed the site has. Feed readers, browser extensions and services like Feedly read those, so pasting the site's address into a reader offers the feeds by name. The list is built from the categories that exist, so it needs no upkeep. On a category page (an archive with a postcategory tag) that category's feed is listed first, so subscribing from /tutorials offers the tutorials feed before the whole-site one.

The bundled themes emit the tags with one line in header.php, after the canonical link. Put the same line in your own theme:

<?php echo swf_feed_link_tags($postcategory ?? ''); ?>

To show the feeds to people as well as to software, the

shortcode renders them as a list with post counts, for an archives page, a footer column or a "Subscribe" page:


Subscribe

It outputs <ul class="swf-feeds"> with one <li> per feed and a <span class="swf-feed-count"> after each, so a theme can style it. See Shortcodes.


What Gets Included

Every live post in pages/posts/ that has a pagetitle and a pagedate. A post without an excerpt gets an empty description; a post without an image gets $WebsiteImage. Drafts (.html.draft files) are never included. The newest $rssMaxItems posts are sent, 50 by default.


Full Content or Excerpts

By default each item carries the whole post in <content:encoded>, with shortcodes processed and Markdown rendered, so subscribers can read in their reader without clicking through. Relative paths in the post (pages/posts/images/photo.webp, links to other pages) are made absolute, because a reader has no idea which site the text came from. The excerpt is still sent as <description>.

To send excerpts only, set in config/config.php:

$rssFullContent = false;

Feed Item Structure

RSS elementSource
<title>pagetitle
<link>, <guid>$WebsiteURL/posts/[filename]. The guid is the permalink, so a reader recognises an item it has already shown even if its title changes.
<pubDate>pagedate, as an RSS date
<dc:creator>pageauthor, when set
<category>one per entry in pagecategory, or "uncategorized"
<description>pageexcerpt
<content:encoded>the rendered post, unless $rssFullContent is false
<enclosure>pageimage (or $WebsiteImage) as an absolute URL, with its MIME type and real file size

Titles and excerpts stored with HTML entities (&amp;) are decoded before being escaped once for XML, so they display correctly in readers.


Channel-Level Information

Channel elementSource
<title>$WebsiteTitle, plus the category name on a category feed
<link>$WebsiteURL
<atom:link rel="self">the feed's own address, which validators and some readers expect
<description>$WebsiteDescription
<language>$WebsiteLanguage-$WebsiteLanguageCountry
<lastBuildDate>the date of the newest included post
<image>$WebsiteImage as an absolute URL

Embedding a Feed in a Page

Your own feed, or anyone's, can be shown on a page with the

Error: RSS feed URL missing.

shortcode:

Error loading RSS feed.

https://example.com/?rss=tutorials

See Shortcodes for its output structure.


How It Works

index.php checks for ?rss before anything else, including the cache layer, loads the shortcode and Markdown parsers and required/feeds.php, and hands over to rss_generator.php. required/feeds.php is the shared source of truth for which posts are live and which categories exist; the autodiscovery tags, the

shortcode and the sitemap all read from it, so they can never disagree with the feed.

Settings, both optional:

$rssFullContent = true; // whole post in the feed; false for excerpts only
$rssMaxItems    = 50;   // newest posts included