Tifoss.log

Open Source, Linux, Embedded Linux, Learning


Static blog generation with blogc

I'm using blogc as my static site generator for this blog.

What is blogc?

Blogc is a static site generator. The official manpage states:

Blogc compiles source files and templates into blog/website resources. It gets one (or more) source files and a template, and generates an output file, based on the template and the content read from the source file(s). It was designed to be used with make(1).

From my point of view, it's quite similar to Hugo or Jekyll.

Why blogc?

I was looking for a static site generator, to document this project. In the past, for other projects, I used Jekyll, Hugo or Pelican, but since this project is about Linux and embedded development, I wanted to use a static site generator written in C.

Blogc looked already on the fist glance very promising. It's using make and autotools, the documentation is done as manpages, and the template syntax is Jinja2 like and was very familiar to me. Because of these reasons, I decided to go with it.

My template

My blog template is a fork of https://github.com/blogc/blogc-the-plain, which is a rebuild of "The Plain v1" Jekyll theme. I forked this repository as https://github.com/tifoss/blogc-the-plain, and did some minor adaptions to match my needs, and fill my data.

How to build the blog?

First, you need to install blogc on your machine.

Install blogc

I forked https://github.com/blogc/blogc and cloned the master branch. Building and installing blogc was quite straight forward. I had to install the dependency ronn ( https://github.com/rtomayko/ronn ), but it's available in the Debian repositories, so a simple apt install ronn did the job.

Building blogc is straight forward, but you should make sure to enable all features you want, e.g. the local preview server:

$ ./autogen.sh
$ ./configure --enable-git-receiver --enable-make --enable-runserver
$ make
# make install

Fill the template

I use my copy of https://github.com/blogc/blogc-the-plain. The template is making use of Gravatar, so I used the chance to create a Gravatar profile for this project: https://gravatar.com/mee0fbe392b72f7

Configuring the template was straight forward. The Makefile contains some parameters. Also the templates are easy to read and to adapt. A look at the blogc source manpage ( https://blogc.rgm.io/man/blogc-source.7.html ) and the blogc template manpage ( https://blogc.rgm.io/man/blogc-template.7.html ) helps to become aware of the formatting and also available template variables.

Local preview

The result can be locally preview using make to build the site, and make serve to run the blogc test server.

After changing something, the following commands update the preview:

make clean; make; make serve

Publishing

I use a Github static page to serve the blog. The content is in a repository on the main branch. I added this repository as git submodule to my template repository and adapted the build folder name.

Back