Static Site Generation with blogc


Up until now I’ve been working on my sites in pure HTML; the only tool I used had been ssg to convert the little “wiki” I put op on GitHub to HTML and use it on my website.
Creating a HTML file every time I wanted to post something on my website is not a viable alternative, though, which is why I was looking for an option to make my life easier. I decided to ask people on the webring thread on lainchan for advice on how to set up a proper workflow for web development, as I am completely new to this.
The nice guy from helped me get some ideas, which ultimately led me to blogc, the static site generator which I’m going to talk about here.

Why I chose blogc

Blogc is simple yet powerful. On their website they state it should be used with a tool like make. It’s not supposed to be a blogging engine but a compiler.
I like this approach, as I am a fan of C (programming language). To be perfectly honest, I don’t have all that much knowledge about make, but I want to learn, and this is part of the reason I’m making this website.

Starting out

To start, I downloaded the test repo they have up on GitHub ( so that I don’t have to figure out everything by myself, as this could also be seen as a piece of documentation.
From there, I started changing my own template.html I had to function as a blogc template. If you want to follow this a bit, have a look at my repo and compare it with the example repo blogc provides.


So far the template is really simple. As I said, I took the template.html I had and changed it to resemble a blogc template. The title is now set per page, copied from the template from the example repository. The links in the navbar are changed so it’s easier to change them, should I ever get another domain.
The main section is now filled with template things. I won’t go into detail, because the man page blogc-template goes into enough detail. It’s essentially just pasting the content of the source file in between the main tags.


Writing the Makefile was a difficult thing for me. Every time I have to write one I need to skim through the documentation again to get stuff done.
Trying to imagine how my site should function with software I’ve never used before is also hard to do.
As I said before, you can find everything, including the Makefile, on my GitHub page.
I also took some inspiration for my Makefile from the example repo. A lot of the variables are taken straight from their Makefile, with values changed, obviously. I removed everything I didn’t need, which included some variables and rules, and I was left with only one rule which I changed to my liking and used as a template for the rest. If you’re not familiar with Makefiles, they’re fairly easy to understand when you figured out the syntax, which is admittedly a bit weird.
For now I list the files I use individually, so I need to add each new blog and wiki entry I the list manually. Depending on where I use the files I pre- and append them with the directory and file ending respectively.

Blogc has 2 modes for compiling:

  • The standard entry mode
  • Listing mode

In entry mode, your entry and variables defined in the source file are available as usual. In listing mode blogc handles every source file taken as an argument. In your template, listing blocks are being executed for every source file to be compiled into one output file.
I compiled my homepage, about, the privacy policy, etc. in entry mode and, for now, will be compiling my blog posts in list mode. The reasoning behind this is that I’m trying to figure out how to generate a listing without listing the content, but will be looking into this another time.

That’s about everything I can talk about. The content as well as the design on this site is largely the same as before, with just a few changes that are probably not even noticeable.

Do you have a comment on one of my posts? Feel free to send me an E-Mail:
To participate in a public discussion, use my public inbox: ~witcher/
Please review the mail etiquette.

Posted on: December 21, 2020

Articles from blogs I read

OpenSSH introduces options to penalize undesirable behavior

In a recent commit, Damien Miller (djm@) introduced the new sshd(8) configurations options, PerSourcePenalties and PerSourcePenaltyExemptList, to provide a built in facility in sshd(8) itself to penalize undesirable behavior, and to shield specific client…

via OpenBSD Journal June 7, 2024

Your Node is Leaking Memory? setTimeout Could be the Reason

This is mostly an FYI for node developers. The issue being discussed in this post has caused us quite a bit of pain. It has to do with how node deals with timeouts. In short: you can very easily create memory leaks [1] with the setTimeout API in node. You…

via Armin Ronacher's Thoughts and Writings June 5, 2024

The state of SourceHut and our plans for the future

Good morning! It’s been a tough year for SourceHut and I know many of our users are waiting to hear from us. Our last update was the post-mortem following the DDoS attack we sustained in January, and we have some additional news following this update as well…

via Blogs on Sourcehut June 4, 2024

Generated by openring