The Wiki that became a Blog

By | 15 Jan 2022

I’ve started collecting knowledge for myself (and for everyone to see) in a DokuWiki back in 2008. In 2014 I found DokuWiki to start feeling dated and explored alternatives. I liked the idea of having all entries as single files and in a standard markup format (compared to DokuWiki’s own markup language), so I started to move all entries to GitHub Pages and in early 2015 my Jekyll-based GitHub-hosted Wiki went online. While this was a great exercise and works really well, it wasn’t ideal. The site being created by a static-site generator means you can only use JavaScript for dynamic things. I had to use Disqus for comments and Google Site Search to allow searching the site. Also, it being based on static text files meant I had to manually track e.g. timestamps of when an article was created or updated by adding (and updating) the times in the Markdown-file’s Front Matter. And creating a new entry meant to checkout everything from GitHub, add a textfile in the correct directory, make sure the Front Matter contains all necessary data, commit the changes into the Git repository and push everything back to GitHub. Then find out there’s a typo, change file, create commit, push again. And it all depended on GitHub willing to host the page. So I wanted to switch to a different system, but wasn’t sure yet which.

A few things I wanted:

  • content written in Markdown
  • SQLite database or flat-file
  • easy to write and publish entries
  • automatic tracking of created-/changed-date
  • simple theming, easy switching between different themes, easy development of own theme

After spending a few evenings researching my options, I ended up installing GRAV. The backend looks gorgeous, it supports auto-updating of itself and restoring from backup means just unpacking said backup into a directory and that’s it.

So I’ve made a tool to convert my Jekyll pages into a GRAV folder structure: jekyll2grav. This worked fine and only needed minor tweaking of some entries still containing Jekyll-includes. At this point I still had the wiki-like structure imported into GRAV, i.e. while every entry had a creation date, they were still sorted into different directories depending on the topic of the entry. While trying to copy the theme from my Jekyll page to GRAV, I noticed various little things that didn’t quite work as I liked them. For one, the publicly available themes (downloadable from within the admin area) all had different ideas of what type of document a blog entry is. For some it’s item, for others it’s default, etc. So no easy switching between different themes without having to check the datatypes.

And when trying to create a chronologically sorted page that shows the newest entry first, I’ve found out that there’s no way to get a list of all entries regardless of their language. GRAV either showed all English entries or all German ones. But never both.

GRAV is also missing any blog-specific API like XML-RPC, MetaWeblog or AtomPub and there doesn’t seem to be any plugin for those. Also no trackback or pingback support.

Finally, after deciding to sort my entries by date instead of a folder structure, since GRAV is a CMS, there’s no single way of how to store the entries. You can create a folder per year, month, day to get something like /2021/12/31/my-entry or you can put everything into one folder and include the date in the entry name like /blog/2021-12-31-my-entry. So it’s either a huge folder with ALL entries or various nested folders with one entry each. But should you later decide that you made the wrong choice, there’s no feasible way to move all entries and rename them properly.

After I came to this realisation, I looked into “proper” blogging software. The big player WordPress doesn’t support SQLite ootb1out of the box and the way to add support is by replacing a few files where you never know if it’ll still work after the next update. Another one I remembered was Movable Type but recent versions don’t support SQLite anymore. Another product I remembered was Serendipity – and it ticked all the boxes.

After setting it up on my webspace, I almost completely rewrote my jekyll2grav converter and turned it into jekyll2s9y which now writes the Jekyll-pages directly into s9y’s SQLite database. Afterwards you just have to copy the database and photos to your s9y installation and have it create the permalinks by changing your permalink structure to something else and back. Then your entries should show up already. And that’s where I’m now.

There’s still a slight problem with the permalinks as I didn’t like the entry ID in my URLs and now – due to stripping some characters from the title – I get a few collisions between German and English entries about the same thing written on the same day. But that’s nothing that can’t be fixed.

After that, I have to think about whether I continue to use Disqus for comments, switch to Serendipity’s comment feature or turn them off completely so discussions can happen on social media. Also I want to look into a different theme, maybe do my own. But that’s future talk.

UPDATE 20 Jan 2022

In the meantime I was able to fix the permalink generation and also import all comments from Disqus. After finding out, I can get all comments in JSON format via their Admin/Moderation area (just check your browser’s developer console) it was as easy as writing another Python tool to map the Jekyll-URLs to the Serendipity-Permalinks and import the comments.

So now I have correctly working permalinks and also all comments from the old page. I guess it’s almost time to kill the old wiki.

UPDATE 2 Feb 2023

WordPress now has native SQLite support. It was first suggested in September 2022. The first implementation (in form of a plugin) arrived in December 2022. While a start-from-scratch setup isn’t supported yet, there’s a nice workaround:

Since the implementation is based on Evan Mattson’s version, you can just use his db.php to do the initial setup and then install the official plugin. You’ll have to disable the sanity checks to have it overwrite Evan’s db.php, but once the plugin is activated, WordPress just works. So that’s what this is now based on as Serendipity is on life-support for a few years now.

And after reading Why I Switched Back From Markdown to Visual Editor on WordPress, I don’t miss Markdown anymore.

  • 1
    out of the box

Leave a Reply