A Website!

2020-02-23

Time of changes.

Last week, after 12 years working for the same company, I have terminated my employment. It was a destabilising moment, followed by a wave of excitement that I'm still riding, about what is to come.

I still don't know about my next moves: for sure a break, and a journey already organized in a couple of weeks, after which I doubt I will be able to remain without working for a long time...

My biggest desire would be to try and earn some living with free software projects. Some of my projects are already widely used, and I have new features in mind to write. Other projects haven't been widely released, but I have used them in my previous company and they are very promising. I have recently set up a funding page: and I'm curious to see if it will become anything relevant.

At the same time, I am enjoying more and more practicing photography, so I was also feeling the need to put somewhere an photographic portfolio, not only a software one.

But let's stop talking about me. Let's talk about this website, because putting it together was actually cool.

How was it made

Unless you need to support several users editing the same content concurrently, each one with different permissions, a database-backed website is not really needed. And if a website is just a bunch of static pages, nice things will happen:

  • you can version it in Git or in your favourite SCM of the past,
  • it's very simple to serve: just a bunch of files on a webserver,
  • it will never be pwned,
  • you can easily find someone to serve it for you: GitHub pages for instance.

Of course I don't want to write HTML by hand, so off I went looking for a static website generator. As we mentioned GitHub pages, Jekyll did come to mind, but it has a couple of shortcomings:

  • it's written in Ruby, which is not my expertise so, in case I needed a quick hack, there would be a lot of overhead;
  • it uses Markdown as markup languages, which is largely inferior to reStructuredText in design and tooling.

Shopping around, I found Lektor, which seems actually a nifty thing. It uses Markdown out-of-the-box as well, but it is easy to add reST using a plugin. For an example, this is this article source.

I tried this setup with the psycopg website, which I migrated from being a Django website to static content, and it was quite a simple task.

Then I went around shopping for a nice template: I found a cool one called Borano (look at the portfolio, it is a joy...). Lektor supports Jinja templates to spit HTML, so now I am in the process of converting the template to Jinja, while at the same time I try and and work out what is that I have to say.

The workflow

All it takes to edit the website is:

  • use my favourite editor (no pesky HTML textarea) to create and edit pages;
  • running make serve the website preview is immediately available on http://localhost:5000/;
  • commit and push to the website repos.

This is where the human work of adding or changing content finishes. What will happen behind the scene will be:

That's it.

I don't think this setup can work for everyone. I could probably set up the system to some non tech friend and explain what to do, but they should at least be comfortable to use git for their regular workflow. It might be actually not such a high bar: if someone would like to try and start publishing a small website please let me know!

Bonus: comments

A blog is not a blog if it doesn't have comments. But open comments take spam with them, which in my experience got very boring to administer.

I was thinking to use GitHub issues to store my comments, in order to leverage their anti-spam system, whilst still being able to take them out in case I'd like to migrate to something else. But apparently it's difficult to have a new idea on Internet, and I found a few implementations already written.

utteranc.es seems a very good one and quick to set up, so here it is... 👇