Automatically generate static website in Node

62 views
Skip to first unread message

Rika Goldberg

unread,
Sep 14, 2021, 1:35:59 PM9/14/21
to TiddlyWiki
Hi All!

I am using NodeJS right now to auto save Tiddlers. I love it!

I expected that a static website (index.html) would get built automatically on save, but that's not happening. What's an easy way to automatically build a static website on each autosave? (I'm thinking ahead to when I will host my site on Github). 

Thanks!


Jean-Pierre Rivière

unread,
Sep 15, 2021, 7:03:35 AM9/15/21
to TiddlyWiki
Hi! Just go to tiddlywiki.com and look out for the "Generating Static Sites with TiddlyWiki" tiddler for full explanation.

in very short: use the --rendertiddlers command of tiddlywiki with the list of all wanted tiddlers as subsequent arguments of the command line. The problem is, this is done in an other process than the one serving as a web server currently run.

Now, if you had the control of the server, you could launch a daemon to just do that on each new or updated file within the tiddlers directory. As for deleted and renamed tiddlers, it would require a simple rm command also launched by a similar mechanism. But of course, this is not possible for any hosting service like github. You would need an other server on your control that would just do that on a copy of the tiddlers files it would keep in sync. I would think that manually launching the update of the static site would be wiser and less energy-hungry.

Regards,

Mark S.

unread,
Sep 15, 2021, 11:56:49 AM9/15/21
to TiddlyWiki
One of the advantages of node is that it only needs to write tiddlers that have changed, rather than the entire TW file. If you "published" a TW automatically, you would undermine this feature.

You can create a standalone any time you want just by clicking on the save button and picking the appropriate save option and location.

If you want to do it the other way, push your tiddlers to GitHub and then automatically publish a page to GH pages, then Saq has a clever technique for you to use:

TW Tones

unread,
Sep 15, 2021, 8:59:11 PM9/15/21
to TiddlyWiki
Mark,

I would suggest a mechaisium could be built within the single file wiki to package only modified static tiddlers for upload to a host as well.

Also many tiddlywiki.html files are smaller than most images, thus a full upload not an issue.

I am not contradicting you only pointing out it is possible even if no one has done it yet. It is not a "hard limit".

Regards
Tones

Reply all
Reply to author
Forward
0 new messages