Problems with CLI tiddlywiki, rendering and plugins

Hello all,

I want to use tiddlywiki to generate a (static) website.

I’ve already installed the CLI version of tiddlywiki (Debian Linux), and I’ve added some content to a single HTML file tiddlywiki

Rendering static files (as documented here (RenderCommand) and here (Generating Static Sites with TiddlyWiki)) didn’t work properly, as the generated CSS sheet didn’t have all the CSS required to show the files properly.

I “solved” this by switching from the --render command, to using a tiddlywiki.info file, with the following content (copied from the TW github):

{
	"description": "Content for https://tiddlywiki.org",
	"plugins": [
		"tiddlywiki/internals",
		"tiddlywiki/katex",
		"kookma/refnotes",
		"kookma/shiraz",
		"tiddlywiki/menubar"
	],
	"themes": [
		"tiddlywiki/vanilla",
		"tiddlywiki/snowwhite"
	],
	"languages": [
            "es-ES"
	],
	"build": {
		"index": [
			"--savetiddlers","[tag[external-image]]","images",
			"--setfield","[tag[external-image]]","_canonical_uri","$:/core/templates/canonical-uri-external-image","text/plain",
			"--setfield","[tag[external-image]]","text","","text/plain",
			"--render","$:/core/save/all","index.html","text/plain"],
		"readmes": [
			"--render","[[Code of Conduct]]","code-of-conduct.md","text/html"],
		"favicon": [
			"--savetiddler","$:/favicon.ico","favicon.ico"],
		"static": [
			"--render","$:/core/templates/static.template.html","static.html","text/plain",
			"--render","[!is[system]]","[encodeuricomponent[]addprefix[static/]addsuffix[.html]]","text/plain","$:/core/templates/static.tiddler.html",
			"--render","$:/core/templates/static.template.css","static/static.css","text/plain"
		]
	},
	"config": {
		"retain-original-tiddler-path": true
	}
}

And now I run tiddlywiki --import blog.html 'text/html' --build static (blog.html is my single-file TW). This has worked well, but…

I’ve added non-core plugins (shiraz, refnotes), and when I run that command

  • I get some warnings (Cannot find plugin 'kookma/refnotes' and similar)
  • The rendered output doesn’t show anything that uses functionality from those plugins.

I have two questions:

  • Am I doing something wrong here, and if so how can I fix it?
  • Am I just “holding it wrong” and should go check some piece of the doc. that I missed?

I feel I’m missing something, conceptually, here.

How exactly have you installed those plugins?

I added kookma’s plugin library and then used it to install those two plugins.

Plugins added via a plugin library or drag and drop should not be added to the tiddlywiki.info file. For plugins added in tiddlywiki.info, tiddlywiki looks for the source code of the plugins, hence the error message. See the note on TIDDLYWIKI_PLUGIN_PATH:
https://tiddlywiki.com/#Environment%20Variables%20on%20Node.js

I see, thanks for explaining.

That said, is there any way of rendering static pages while using just the single-file HTML TW? as I mentioned at the start of the thread, using --render directly doesn’t seem to work.

What were are the exact commands you executed when using --render?

tiddlywiki --output $OUTPUT_DIR --import blog.html  'text/html' --render "$:/core/templates/static.template.html" "static.html" "text/plain"
tiddlywiki --output $OUTPUT_DIR --import blog.html  'text/html' --render "[!is[system]]" "[encodeuricomponent[]addprefix[static/]addsuffix[.html]]" "text/plain" "$:/core/templates/static.tiddler.html"
tiddlywiki --output $OUTPUT_DIR --import blog.html  'text/html' --render "$:/core/templates/static.template.css" "static/static.css" "text/plain"

Try using the --load command instead of --import

https://tiddlywiki.com/#LoadCommand

1 Like

When using --load I get the same behavior as with --import: warnings about missing plugins, and incomplete CSS in the static output.


I’ll try again with another pristine wiki, and perhaps with a one-file-per-tiddler wiki, generated by tiddlywiki.

Also, I’ve just noticed that my TW is v. 5.3.6., while tiddlywiki --version reports 5.3.5 … I wonder if that might be causing the issues here.

Eventually I found this script: tiddlywiki-static-publish/build.sh at main · bmann/tiddlywiki-static-publish · GitHub , which basically

  • Converts a single-file wiki to a dir-based wiki
  • Then generates the static version of the site, using the dir-based wiki

That approach —although a bit wasteful— works, and yields properly rendered static pages.

1 Like