WikiBlog is a simple wiki generator that creates an index page with backlinks for each article. Inspired by WikiWikiWeb.

WikiBlog uses the following directory structure.

.
├── articles/   # Your articles will be written here.
├── creation/   # Database of article creation times. Entries are autogenerated
├── x/          # Put images and css in here
│
├── flake.lock  # Nix dependency lock file
├── flake.nix   # Nix dependency file
├── generate    # Generate all pages
└── regenerate  # Watch for changes and call generate

WikiBlog uses template files as input. These are just plain HTML files annotated with @ for linking within the wiki. Such a link looks like @MyLink, it only accepts alphanumeric sequences, and stops as soon as a non-alphanumeric character is encountered. To escape @ use @@. The code @* prints the full article index, and can be escaped by prepending a @ - as such: @@*. Finally, bash commands can be run by using @(ls -la).

The contents of a template file will be pasted into the generated HTML file's <body>. This happens after transforming @ to HTML links. These contents are not escaped. WikiBlog-internal links will be backreferenced at the bottom of each article.

Note that the directory for images and css must be x/. The generator puts a header on each article that references the following files.

x/favicon.png     --- Site icon
x/favicon16.png
x/favicon32.png
x/favicon64.png
x/main.css        --- Site-wide CSS

An additional file x/title is used as the title for the index page. The titles of the other pages are identical to their filenames.

Finally, modification times are fetched from the articles/ metadata. The file system has to support modification times (in addition to writing out the modification time on actual modification) for this to work. Normally this should be working by default on most systems.

Getting Started

Copy flake.nix flake.lock generate regenerate into a directory.

Create directories articles/, creation/, and x/

Create a file in articles/ called HelloWorld, write some html.

<h1>Hello World!</h1>

If you're using Nix you can run nix develop to handle all the dependencies needed for generate. Otherwise you'll need to manually handle them for your platform.

Run the script generate in the root directory of the project to generate an HTML file for each article. Once this process is done the finished HTML files are stored in the root directory. Use any web browser to open them.

It is advised to create a file articles/index containing @* which prints the list of all articles. This is compatible with most webservers that will redirect to the index file if available.

Hosting and updating

Updating a website is as easy as rsyncing the entire directory to a server. This site generator is also git-friendly.

Hosting a WikiBlog is also easy! You simply command a webserver like nginx to use the root directory. Because the index is called index it should automatically be called upon for accesses. Because articles are just plain file names, no URL rewriting is needed.