Building blog based on GitHub pages

After some time I once again tried to create a blog. This time with it should be nice static site with dark design and only memories.

At first I went on journey to find a nice dark theme which I would use as a base. After a bit I found tocttou/hacker-blog which is really nice. See demo.


It sounds all nice and fine but it is a bit plain. I decided that categories or tags would be nice. I chose tags because it is shorter and looks better. After a bit of search I stumbled upon a nice example. In the end it required a bit more work to add all functions but the basic idea was there. I added list of tags for each post on index:

List of tags on the index page

List of tags on the index page

memory page:

List of tags on the memory/post page

List of tags on the memory/post page

and tags page:

List of all tags with posts (like an archive for tags)

List of all tags with posts (like an archive for tags)

Even if it looks easy it took me a while. I also added some hidden features which noone will probably see unless you look at the code.

RSS / Atom feed

The theme / blog came with some atom.xml file which generated Atom compatible feed. I thought it is pain to manage and went for Jekyll plugin jekyll-feed. This plugin can create nice feeds, it should also be able to create feeds for each category. After many trials and errors there was a catch. the plugin could create category feeds only if category variable for post (memory) was present. Because I decided to use tags I changed it to categories, and so it did not work.

So I went and downloaded template from jekyll-feed repository and adapted it to work with my project. Surprisingly it was easy to do. After it was done I saved it as feed.xml and also saved a copy at feed/KDE.xml

Making the generated code nicer

After a while of working on the site I was more and more dissatisfied with the html code it generated. HTML was fine but there was a LOT of blank lines with white spaces left from templates.

The way how to get rid of this is to ass - at the beginning of template tags. That will make the Liquid template engine to remove the line on which this element is.

{%- template logic ... %}

After using this syntax on almost whole template the generated code looks much nicer.

Add videos

In my second post I wanted to add few videos. There are already prepared solutions to load youtube, video and some other external video services. But I wanted to host these small mini videos in git repository, so it was no go. It is sad to say but there is not {% video url %} tag. After a bit of searching there is truly a nice solution.

The files in _include directory can take a parameter when included from other files. See documentation.

While I was at it, I made it so that it is nice and easy to use. The code can be found in the repository.

In the “template” file I also included ffmpeg commands to convert video to mp4 and webm which are supported by browsers these days.

Example of usage:

{%- include video_embed.html video="video name" extensions="mp4,webm %}

It is easy and nice.

Revising feeds

After I learnt of this nice feature I adapted RSS feeds and made them use one template called atom.xml.

The whole xml file can now be reduced to few lines:

layout: none
tag: KDE
{% include atom.xml %}


Third-party plugins sucks.

Make your own and be happy.

The code with all changes and “tweak” can be found at Gitea.

Articles from blogs I follow:

Richard Stallman's political discourse on sex

Richard Stallman, the founder of the Free Software Foundation, has been subject to numerous allegations of misconduct. He stepped down in 2019, and following his re-instatement in 2021, a famous open letter was published in which numerous organizations and i…

via Drew DeVault's blog November 25, 2023

Upgrading to FreeBSD 14 - how to fix a broken BIOS bootcode

A lot of people running ZFS zroot have managed to break their FreeBSD systems upgrading from 13.2 to the new 14.0 release because of a broken BIOS bootcode. In this tutorial I'll show you how you can fix that without having to reinstall.

via November 22, 2023

C++ Guidelines

C++ is definitely a language that has Lots of Ways to do It – kind of like Perl’s TIMTOWTSAC. A consequence is that when writing code, you need to think about which way to do things. When context-switching between projects, employers, or what-have-you, yo…

via [bobulate] November 21, 2023

Generated by openring