Static publishing of TiddlyWiki

Speaking with @kilomeow, we’re wondering if it would be possible to do static publishing of a TiddlyWiki on Fission, to a Fission site or folder, within the browser.

This is the starting point we found on the main TW site:
https://tiddlywiki.com/#Generating%20Static%20Sites%20with%20TiddlyWiki

This uses NodeJS. Which non-browser APIs are needed, and would it be possible to make work fully in browser?

1 Like

@Jermolene please let us know if you’re going to tinker with this. @kilomeow would like to flesh this out into something more proper, so any start would be great.

After little research, I found core/modules/commands/render.js which is repsonsible for producing static html files. The little problem here is that it’s only single tiddler method, but for a start we could just concatenate it.

So given tag blog and specific template we want to do something like:

var tiddlers = $tw.wiki.getTiddlersWithTag("blog");
    result_html = "";

$tw.utils.each(tiddlers,function(title) {
    var parser = wiki.parseTiddler(template),
        variables = {currentTiddler: title};

    var widgetNode = wiki.makeWidget(parser,{variables: variables}),
        container = $tw.fakeDocument.createElement("div");

    widgetNode.render(container,null);

    result_html += container.innerHTML;
}

I don’t know yet if there will be any difficulties if I implement this as a plugin, I’ll give a try

1 Like

Hi @kilomeow that’s along the right lines. The core JSZip plugin does something similar for rendering static sites into a ZIP file:

Getting a proof of concept up and running shouldn’t be too difficult. I’ll make the TiddlyWiki on Fission repository public in the next couple of days which should make a reasonable test bed for your experiments.

I’d like to get to the point where TW has a “publish” button next to “save changes”, that invokes a generic framework to generate a static site from a sitemap and pushes it to Fission, a ZIP file, or the file system on Node.js.

2 Likes

Hi @kilomeow apologies, it took a little longer than expected, but the repo is now public:

To get the static files stuff working we’d need to add some more event handlers for things like “tm-fission-render” and “tm-fission-publish” here:

1 Like

The very early version of the FissionPublisher plugin is available! Check out the demo.
At the moment it allows you to simply export tidlers with the desired tag as a static html:
Screenshot_2021-03-10 Fission powered blog(1)

There is still a lot of work to do - add the export of tiddlers as separate pages, add links between, a disqus/commento/whatever comments under the posts. I want to look a bit more how is done Anne-Laure’s digital garden (and disassemble JSZip core plugin).

However my next will be towards webnative – let’s try to create new fission application from tiddlywiki based on @Jermolene developments.

2 Likes

Ammmmaaaazzzziiinnnnnnng!

Great job @kilomeow – so stoked to see this! I’m going to try it out right away.

1 Like

OK, I wrote up how to install, using my public TiddlyWiki, of course!

@kilomeow has a version up at https://charming-senior-teal-griffin.fission.app/

2 Likes

Hello @Jermolene ! There have been several updates in the TW on Fission since our last talk. It is noticeable that you added a static publishing edition and also some new functions for publishing. I want to finish my publishing plugin to get it work with Fission in a way that it will create individual fission app and publish blog content there. What is preferred next step? Add tm-fission-create-app and tm-fission-publish to startup.js or work on fission-publisher.js ?

Also after James talk on Stork I think it’s must have to enable Stork as a search option for a static published websites on Fission. Specifically Stork’s index building could be included to publishing process and client-side js/wasm just bundled to the blog template.

2 Likes