When I started to use Hugo, I told myself that I had to implement some kind of way to use existing apps in order to make it enjoyable. I really enjoy the Micro.blog apps and I really enjoy MarsEdit. The result is micropub and oldpub. Both of them are written in Python and Flask; they are also ready to be used in a public facing server.
The micropub server is really simple. It supports a few different contexts and uses IndieAuth for authentication. The way it works is that when you upload a image it uploads it to the appropriate location on your file system, and the micropub endpoint takes the data and turns it into a text file that Hugo uses to generate your website. I went with Python and Flask for this because it is very minimal and easy to use.
Oldpub is a implementation of the Wordpress XML-RPC API. I have only implemented the parts of it that I care about. How I ended up with Flask here is a result of a lot of Googling. There are some Ruby implementations of the MediaWeblog API, but none of them are complete enough to work in a production system. And I found a some example code for a implantation using Flask and Python. That code was the starting point. The big difference between this implementation and a typical database driven one is that it has to read files and folder structures instead of da SQL database. This means that the code is a little bit more complicated and slower. But thats fine, since the only purpose of these API’s are to publish to a blog.
The next step how I host and update my sites. All of my stuff are hosted on a Linode server, using docker. I’m not going to get too deep into the configuration of it, but NGINX hosts the static files for my Hugo sites, and runs in front of all my server software. And the way I update my Hugo sites is that all the content are in GitHub repositories, and I have a script that pulls changes, adds changes and pushes them up to GitHub before I rebuild the site. It is just a simple shell script that runs in cron every X minutes.
I’m not going to continue to use them myself however, because I’m working on my own CMS. But the current implementation works perfectly fine and I have used it for over a month.