TiddlyWiki is a single static HTML file. It does not generate an RSS feed of new entries. It doesn’t generate anything.

I treat my wiki at wiki.baty.net more like a blog than a wiki, so not having an RSS feed feels like an omission. Most of the time I consider this to be a feature. I like that I can write any old nonsense and it doesn’t actively go out and bother anyone. It’s my little secret, that you can read if you want.

On the other hand, I find it annoying when I’m interested in someone else’s writing and they don’t provide any feeds. So, I’ve decided to make it easier to follow me. I suppose if you deliberately subscribe to the wiki’s feed, you want to be bothered by the stuff I write there.

My solution is based on this article. The short version is that I created a new tiddler named “RSS Feed” containing the following:

\define MyFilter(MyTag,domain)

<?xml version="1.0" encoding="UTF-8" ?><br />
<rss version="2.0"><br />
<channel><br />
</title><br />
     <link>{{$:/discoverfeed!!serverdomain}}</link><br />     <description>
</description><br />
     <lastBuildDate><$list filter="[!is[system]get[modified]!prefix[NaN]!sort[]limit[1]]" variable=modified><$list filter="[!is[system]modified<modified>]"><$view field="modified" format=date template="[UTC]ddd, 0DD mmm YYYY 0hh:0mm:0ss GMT"/></$list></$list></lastBuildDate><br />
<$set name="MyTag" value=Feed>
<$set name="domain" value={{$:/discoverfeed!!serverdomain}}>
<$list filter=<<MyFilter>>>
<item><br />     <title>
<$view field="title"/>
</title><br />
     <link><<domain>>#<$view field="title" format="urlencoded"/></link><br />
     <guid><<domain>>#<$view field="title" format="urlencoded"/></guid><br />
     <pubDate><$view field="modified" format=date template="[UTC]ddd, 0DD mmm YYYY 0hh:0mm:0ss GMT"/></pubDate><br />
     <description><![CDATA[<$view field="text" format=htmlwikified/>]]><br />     </description><br /></item><br />
</channel><br /></rss><br />

This tiddler runs a filter finding the last 10 tiddlers tagged with Feed and renders them as RSS-formatted XML.

Extracting the rendered text from that tiddler out to an RSS file is done using my Makefile using the TiddlyWiki node.js module. The command is as follows:

tiddlywiki --load index.html --render "&#91;&#91;RSS Feed]]" "rss.xml" text/plain

This generates a file at ./output/rss.xml containing the rendered RSS text/xml. Later in the Makefile, I rsync rss.xml up to the server along with the rest of the wiki files. Here’s the complete Makefile:


.PHONY: checkpoint deploy

        tiddlywiki --load index.html --render "&#91;&#91;RSS Feed]]" "rss.xml" text/plain

        git add .
        git diff-index --quiet HEAD || git commit -m "Publish checkpoint"

deploy: build checkpoint
        git push
        @echo "\033&#91;0;32mDeploying updates to $(TARGET)...\033&#91;0m"
        rsync -v -rz --checksum --delete --no-perms $(PUBLIC_DIR)index.html $(SERVER_HOST):$(SERVER_DIR)
        rsync -v -rz --checksum --delete --no-perms $(PUBLIC_DIR)output/rss.xml $(SERVER_HOST):$(SERVER_DIR)
        rsync -v -rz --checksum --delete --no-perms $(PUBLIC_DIR)files $(SERVER_HOST):$(SERVER_DIR)

All this means is that you can now subscribe to the daily posts at wiki.baty.net using the following URL: https://wiki.baty.net/rss.xml.

The odd thing is that I normally create each daily post first thing in the morning and update it throughout the day. I’m not sure how different RSS readers will handle this, but it’s a start.

I haven’t added the discovery links yet, but should. I also don’t think the RSS tiddler needs all those non-breaking spaces so I may play with that later.

Update March 11, 2022: Saq Imtiaz sent a link to his experimental plugin for generating RSS and JSON feeds. Worth a look!