I am wondering if anyone has a template for static publishing of a TiddlyWiki into an RSS feed?
I haven’t worked much with static publishing but as far as I can tell it should be possible.
For now, I’m thinking of a simplistic version where I publish the single file TW, but also a feed.xml that just points to the #hash-links.
An advanced version would generate the static HTML of all tiddlers, and then re-use the paths of the tiddlers as the permalinks in the feed. Using the same format for generating the path/to/file/slugs.html and running it twice would work, don’t know if WikiText is sophisticated enough to do this in one pass?
Anyone have some existing snippets or guides around this?
Any other documentation / tips around static publishing would also be appreciated.
Boris,
RSS was provisioned in TiddlyWiki classic but has being neglected since in part because of the file save issues since “the Firefox apocalypse” when browsers got much more restrictive.
Some guidance
The Node version can automatically publish “static or HTML” tiddlers in addition to the interactive wiki. This is done via a template, a version of which could be crafted to publish an RSS feed.
For the single file wikis;
I expect there is a way to allow “secondary files” generated from a template to be saved to the host. Yet to be developed but long sought after by myself.
As long as you create a template that can generate the RSS feed, ie extract the required information from tiddlers such as filtered on the modified date you could export and save this along side the single tiddlywiki on the host. Although this is a manual process maybe it need only be done as content changes demands it.
If you need to generate multiple files for RSS (I can’t recall the format) you could generate a multi-file zip to download and extract on the host.
If you come across a good RSS feed file standard/documentation I could try to build an appropriate template for you.
I’ve manually built RSS multiple times for static site generators, I was hoping that there was an existing template.
Yes my plan would be to do a GitHub Actions build process using NodeJS to generate this automatically. Saq documented this so I should be able to extend it.
Here’s an example done in the Liquid templating language for an Atom feed:
It’s just a single file, the core loop is fairly self explanatory:
<item>
<title>Tiddler Title</title>
<dc:creator>Author</dc:creator>
<description>The full content of the tiddler</description>
<pubDate>RFC822 Publish Date</pubDate>
<link>Link to Tiddler</link>
<guid isPermaLink="true">Link to Tiddler</guid>
</item>
So just to show how simple this is here is an incomplete macro for generating the RSS file. It would only include tiddlers with the published date and could filter the last N tiddlers.
Wrap the items with the rss header info and any variables therein
The macros for the permalink may need wikification, see info tiddlers
Tiddlers with content and the published date, limited by a most recent count?
Format for the RFC822 date
Check if the use of the permalink macro is appropriate in both places.
I hope this helps. I can’t put the time in to complete this weekend but this would allow a download from an actual single file wiki, without Github involvement.
I have a Feeds plugin that I wrote a while back specifically for use with Github actions that amongst other things generates RSS and JSON feeds. It is currently in the process of a complete rewrite to make it easier to use from within TiddlyWiki as the first incarnation was dependent on nodejs.
I will see if I can quickly extract the salient bits for an RSS feed from dependencies and share it.
OK I found the time to have a quick go at trying to extract the RSS bits and resolving non-core dependencies, hopefully I got everything: feeds.json
The main tiddler is $:/plugins/sq/feeds/templates/rss, there are config tiddlers for customizing the title, what tiddlers to include etc. I think everything is configurable now as opposed to the hardcoded first incarnation. I don’t recall how far I got in the refactoring process last time around that I worked on this, so I recommend validating the output to make sure all the fields are there and correctly formatted.
Here is a fun little extra (very minimally tested):
Using the excerpts from the Feeds plugin that I shared, you can also save an RSS feed along with your wiki using the Fission or Github uploader with the FileUploads plugin.
In order to get this working, you need a custom save wiki button to save the RSS feed along with the wiki (assumes auto save is turned off) and a custom filter for the FileUploads plugin as seen here: Saq's wiki — a non-linear personal web notebook
This is the sort of thing that hopefully will eventually become a core capability with the intended savers and syncers work as discussed on the community call.
I believe it has been done. I can’t recall the name of the individual who made this but I believe Tobias Beer picked up on it and you can see one use of it in his (incredible) tb5 site - note the RSS symbol next to the wiki subtitle.
Uploading an RSS feed with the FileUploads plugin involves three steps:
Generating an RSS feed from the template and saving it in a tiddler with an appropriate title: e.g rss.xml
Having the FileUploads filter configured to upload that tiddler.
Having a separate button to generate the RSS feed in step 1, triggering its upload, or a custom save button that saves the wiki and generates the RSS feed.
Now with the latest version of the FileUploads plugin you can avoid customizing the filter in step 2 and just use the same button that generates the RSS feed to also upload it directly using the tm-upload-tiddlers message, example:
On the off chance that you haven’t seen this already, there is a ‘howto’ of sorts on techlifeweb dot com (have to do this as I’m only allowed one link in a post, apparently :-)). I’ve written up the way I’ve done it based on the information from there on my site, including the relevant links to the pages on techlifeweb.
PS : You dont need the base64 plugin from tobibeer with the github uploader, it’s only needed for the PUT uploader (it wouldnt upload text file otherwise).
EDIT: @rmorrow wow this is much cleaner than what I’ve come up with :o