This is a static build of my TiddlyWiki.
Each tiddler (page) is written to its own file, with the page name determining the filename via "slug" transformation (e.g. Wiki Setup becomes wiki-setup.html). See Slugified URLs below.
All files tagged Static are output in their raw format to the output directory, with a path based on the file name. See favicon.ico and robots.txt.
Build script
A systemd service rebuilds the site periodically:
[Unit]
Description=Tiddlywiki Sixohthree Build
[Service]
WorkingDirectory=/var/sync/wiki/sixohthree
Type=oneshot
ExecStart=rm -rf /var/sync/wiki/sixohthree/output
ExecStart=tiddlywiki /var/sync/wiki/sixohthree --build static
ExecStart=rsync -rpc --delete /var/sync/wiki/sixohthree/output/ /var/sync/share/wiki/
User=annikaThis service is run by a timer:
[Unit]
Description=Tiddlywiki Sixohthree Build Timer
[Timer]
OnCalendar=*:0/5The build script clears the output directory to remove dead files, runs the TiddlyWiki build command, and locally rsyncs the files to a Syncthing folder. -r copies recursively, -p retains permissions, -c copies via checksum (prevents overwriting unchanged files, so we don't unnecessarily trigger the file sync).
Syncthing uploads the files to my web server, in the directory configured in nginx.conf.
Config files
- tiddlywiki.info – tiddlywiki config and build instructions
- nginx.conf – web server config
Slugified URLs
I use spaces in many page names, and these names are "slugified" when building the static site. Rather than Foo%20Bar.html, we get foo-bar.html.
In tiddlywiki.info, the --render argument [slugify[]addsuffix[.html]] handles this for writing files.
Tiddler links within each page are transformed using a macro in $:/core/templates/static.tiddler.html:
\define tv-filter-export-link() [slugify[]addsuffix[.html]]RSS Feed
A tiddler $:/feed.rss handles the RSS feed. The feed is maintained by hand by adding a new <item>. The tiddler has a type of application/rss+xml and is tagged Static.
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>sixohthree wiki</title>
<link>https://wiki.sixohthree.com/</link>
<description>external brain</description>
<!-- pubDate: https://fry.stop.wtf/rfc822 -->
<item>
<title>SSH Agent Forwarding</title>
<link>https://wiki.sixohthree.com/ssh-agent-forwarding.html</link>
<guid>https://wiki.sixohthree.com/ssh-agent-forwarding.html</guid>
<description>This page describes my SSH Agent forwarding setup, which works well with ControlMaster (connection sharing) and tmux(1).</description>
</item>
</channel>
</rss>Additionally, a tiddler $:/config/ViewTemplateBodyFilter/application/rss+xml forces the RSS tiddler to render in a preformatted block inside the non-static site, for convenience. That tiddler has a field list-before set to $:/config/ViewTemplateBodyFilters/default.
[type[application/rss+xml]then[$:/core/ui/ViewTemplate/body/code]]Props to @xlbilly@mastodon.social for pointing me to this configuration and the View Template Body Cascade.