Create your personal wiki with Simiki

Dec 8, 2015

I wanted to create a wiki to document my studies, researches and experiments for future refereces and share it with the internet.

My requeriments for the software that would ‘run’ the wiki was that it has to generate a static website, have simple configuration and be under active develoment. Simiki fill all this requirments and with a bonus: It’s written in python!

So lets create the wiki:

You can install simiki with pip. I highly recommend that you isolate your python application you can archive this with virtualenv.

Install pip:

$ pip install simiki # add sudo to the begining if you are not using virtualenv

Create the wiki:

$ cd /desired/path/of/your/wiki
$ simiki init

The command will copy the configuration file: _config.yml, a sample page: content/intro/gettingstarted.md, a fabric file: fabfile.py to easy generate/preview/deploy the site and the theme folder where the templates lives.

The options on the configuration file are pretty straightforward, but note that if you want your wiki on a subfolder i.e: example.com/wiki, you want to change the root: option, not the url:

root: /wiki

Other interesting option is the destination:, you may set it to a path that is accessible to a webserver like apache or nginx, that you may already have running. I for example have mine set to ~/Sites (OS X equivalent to the ~/public_html).

To create your wiki entries is simple as running the following command:

$ simiki new -t "Title" -c category

Or just create a file folowing this path: content/$category/filname.md:, and add the title and date to the file’s header.

+++
title: "Title"
date: 2014-12-31 00:00
+++

I also modified the fabric file to add a function that auto-regenerate the html if any modification happens on the content/ folder, so I will always have a local version, that will be served by apache and just a cronjob is need to push the changes to the public wiki.

import time
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler


class Handler(FileSystemEventHandler):
    def on_modified(self, event):
        g()


def l():
    event_handler = Handler()
    observer = Observer()
    observer.schedule(event_handler, path='content/', recursive=True)
    observer.start()

    try:
        while True:
            time.sleep(1)
    except (KeyboardInterrupt, SystemExit):
        observer.stop()
    observer.join()

Simiki may not have some useful features on the web pages such as revision history and search (I use git and ack respectively on the terminal to solve this). But I can edit my entries on vim which is pretty cool.