TiddlyWiki as a static site

14th November 2021 at 9:54pm

I used a VPS for this, for me it's simpler to have it there. I can have Editor's console on port 8080 and VPS will serve pages over the web as well. Not going to go into details of account creation, configuring firewall (ports 22 and 8080 should be open for your IP, 80 and 443 - worldwide, or you might want to use loadbalancer, idk), setting up DNS record, webserver and LetsEncrypt certificates, there's plenty of info on that part.

Just install NodeJS - https://nodejs.org/en/download/package-manager/ Then in command line:

sudo npm install -g tiddlywiki mkdir tiddlywiki cd tiddlywiki/ tiddlywiki –init server tiddlywiki –listen host=0.0.0.0

You should be able to go to http://IP:8080. Play around with wiki, create some pages, etc.. Another thing is that we need an ability to publish changes to actual site. for this we need script like this:

#!/bin/bash tiddlywiki –rendertiddlers [!is[system]] $:/core/templates/static.tiddler.html static text/plain –rendertiddler $:/core/templates/static.template.css static/static.css text/plain rm -f /var/www/sitename/html/* cp ./output/static/* /var/www/sitename/html/ cd /var/www/sitename/html/ mv Main%20Page.html index.html

Call it build.sh, put it into created tiddlywiki folder, do chmod 755 build.sh. Add yourself to www-data group (sudo usermod -a -G www-data username). And now anytime you need to publish changes, just run it like ./build.sh.

There we 1st run some TiddlyWiki magic which puts final site into tiddlywiki/output/static folder. Next we need to remove all previous files from webserver root folder and put new content there. Last 2 lines is to rename whatever page you want to use as a start page to index.html.