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.

Customization

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 %}

Conclusion

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:

Why is your open source project still hosted on GitHub?

Perhaps the younger generation don't know anything about the past "evils" of Microsoft and naively believe that Microsoft is now the good friend to open source, but the truth is that all Microsoft acquisitions of open source projects is a busi…

via unixdigest.com May 22, 2025

StarFive VisionFive v2 and FreeBSD

This week I powered up the StarFive VisionFive v2 board that I have. I figured I would give FreeBSD another whirl on it, in the vague hope that RISC-V boards are a more cohesive family than ARM boards were five years ago. tl;dr: I didn’t get it to work as…

via [bobulate] May 20, 2025

Steve Ballmer was an underrated CEO

There's a common narrative that Microsoft was moribund under Steve Ballmer and then later saved by the miraculous leadership of Satya Nadella. This is the dominant narrative in every online discussion about the topic I've seen and it's a commo…

via danluu.com October 28, 2024

Generated by openring