Creating A Static Webpage Using Tiddlywiki

2015/4/23 16:17

Overview

I keep notes on various things in Tiddlywiki and it is very useful to be able to export my blog from the same resource. Currently TiddlyWiki has a good but bare bones static export mechanism, I have made some small changes to the core and a couple of plugins to enable something more along the lines of what I want in a static blog.

Put simply, if I tag any tiddler within my tiddlywiki with blog it will be included as part of my blog when I run the export batch file.

Plugins

One repository, https://github.com/welford/twstaticblog/, split into two:

https://github.com/welford/twstaticblog/tree/master/helper
Exists within your TW and lets you customise the blog's output without having to worry about the format of your own TW changing. By editing the tiddlers in this plugin you can change the name of the blog, which tags define your blog, how posts are linked to, and several other things.
https://github.com/welford/twstaticblog/tree/master/export
Invoked when exporting the blog, this plugin swaps out some of the core view template tiddlers for those in the helper and as such should not be imported into your own TW. It also contains the templates used when constructing each type of page (The types, discussed below, are Blog Post, Index, Framework, and Tag)

Templates

The tag names listed below are easily changed via the plugin.

Blog Post

Tag any article blog and it will be exported as part of your blog. the output directory will be ./YYYY/MM/DD/[tiddlername].html based on their creation date of the article.

You can change the tags which define a blog post via $:/plugins/welford/twstaticblog/helper/blogentrytags

e.g. This post you are reading

Index

Any recently created article tagged with blog will be included in index.html. This can be prevented by also adding the tag unindex

e.g. phasersonkill.com

Framework

Tag any article blog-framework and it will be exported as part of your blog as a "framework" post. The output location in the root directory. I define a framework article as being a post which helps you navigate the site or one that is accessabe everywhere. I have included a few example framework posts in the helper plugin.

You can change the tags which define a framework post via $:/plugins/welford/twstaticblog/helper/blogframeworktags

e.g. Tags, About both linked to at the top of this page

Tag

As this is a static site generator there is no search functionaity. My plugin auto-generates tag posts based on any tag in Blog or Framework posts as a kind of simple site-map. You can exclude tags from being included in this by adding them to the tag list in $:/plugins/welford/twstaticblog/helper/hiddentags

By default the following are excluded:

e.g. tiddlywiki personal OpenGL <- you can click on these and jump to specified tag page.

Default Tags

All the tags listed above are fully customizable :

plugin tiddlerpurpose
$:/plugins/welford/twstaticblog/helper/blogentrytagsDefines which tags constitutes a blog post
$:/plugins/welford/twstaticblog/helper/blogframeworktagsDefines which tags constitutes a blog framework
$:/plugins/welford/twstaticblog/helper/donotexportDefines which tags should not be exported even if they are tagged as a blog posts or blog frameworks
$:/plugins/welford/twstaticblog/helper/donotindexDefines which tags will filtered from the index post
$:/plugins/welford/twstaticblog/helper/hiddentagsDefines which tags will be excluded from tag posts and from the tag lists below the title of artiles.

Static Bannner

A banner can be added to the top of every page via $:/plugins/welford/twstaticblog/helper/staticbanner in my case I use it to link to some of the framework posts.