My website setup

Post created: 2020-05-01

Post updated: 2020-06-04

Written by Marcel Mehlmann


Introduction

After years of neglecting my website i decided to build myself a new one. I was never satisfied with the solutions out there so i ended up there with writing my own HTML over and over again. 😔

This approach resulted in a few unpleasantries (all revolving around updating) which resulted in a stale, outdated website overall.

I started my journey into recreating my website out of two factors:

In this article i want to provide a brief overview about how my website is build. It will not be a tutorial but more of a set of ideas in order to get you thinking.

Right now my website contains three parts or views:

The whole thing is written in python utilizing the flask-framework with jinja as templating engine.

The landing page

There is not much to say about the landing page. It is a simple page created in jinja and some hardcoded HTML. I do not expect this page to be updated often so this approach is the simplest one between speed and simplicity.

The blog

Okay, i admit this part is a little bit more interesting. Why? Because i tried to create a simple workflow which would allow me to blog easily without the hassle of implementing a blog system.

You see, every article is just a restructuredText file laying in a directory with the name of the file following a specific pattern. The filename consists of three parts which are creating the \"metadata\" around every article. The three parts are: [\<Date in ISO 8601>_\<Blog title separated with hyphens>_\<Language in ISO 639-2/T>.rst]{.title-ref}

These metadata are then displayed as links on the blog page.

The article

When a link has been clicked the user then is taken to the article. In this view the corresponding restructuredText file is opened and its content is fed into docutils to convert the restructuredText into HTML an then this HTML is displayed next to the metadata in the article view.

The reason

Why did i choose this approach? In times where half of the people choose either a real blogging framework or a static site generator this approach might be confusing2.

I chose restructuredText over Markdown because i find it more consistent. The feature set of restructuredText is not dependand on the renderer i choose.

I chose flat files over a database because it was easier to implement.

Benefits of choosing flat files:

This approach also has its drawbacks:

Final Q & A

Is there a way to upload an article without publishing it?

Yes. Just prepend your file with a dot.

How do you keep track of your changes?

Locally i am using git. To reflect changes in an article i will be using appropriate tags.

So your blog has basically no backend?

In a stricter programming definition my blog still has a backend because it parses the restructuredText. In a broader web definition my blog has no backend since there is no admin view.

Why not just a static site generator?

I tried several (Hugo, Pelican, Nikola,...). I even wrote my own. But i never really liked them.

restructuredText is weird

Yes.

Your CSS is not very pretty!

Yeah, i am working on it. If someone has some ressources for me how to produce decent looking css feel free to shout at me. My mastodon handle is: @mzumquadrat@fosstodon.org.


  1. Basically this article and another one 

  2. There is nothing wrong with both ways. They just do not work for me. 

  3. Basically chuck the file content into docutils. No need for cutting of the first n lines in order to get the metadata