<< Go back to Posts

Kiwix for Self-Hosting Websites





Introduction

On my local home server; I wanted to host a personal blog with photo familly. For this, I didn’t want to host it on the web, only on a local network only authorized person can access.

Therefore, I installed Kiwix, which help hosting resources (like wikipedia) on your server.

Zim

The content you can download are .zim files. Under the hood, it is very similar to a .zip, you can decompress it and get the files back.

There is a python Library, but the documentation is quite lomited.

So I implemented a tool which takes as input the _site/ generated by jekyll, add some metadata and create the .zim.

My tool on Github

Challenge of building the tool

Absolute VS Relative Path

In jekyll, as in most website engine, the path are absolute /path/to/index.html, we do not care about the domain name. Here, with kiwix, the main problem is that the root is the kiwix server (not your website). So you need to rewrite all the path in all files …

Index resolution

Second issue, some pages links like /path/to/folder/ refers to /path/to/folder/index.html (if it exists). Kiwix does not seems to correctly resolve that, so my app check if an index file exist, and if yes, convert the path to the index.html path.

Additional Consideration

First goal was for hosting my own website at home. Another goal is to store / make a library of content I want to keep from deletion, as for archive.org

So it is possible to download a website / a part of a website with httrack, and to package it as a zim file.



>> You can subscribe to my mailing list here for a monthly update. <<