Static Site Generation with blogc

Introduction

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 concealed.world 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 (https://github.com/blogc/blogc-example) 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.

Template

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.

Makefile

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 create.to 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: witcher@wiredspace.de
To participate in a public discussion, use my public inbox: ~witcher/public-inbox@lists.sr.ht
Please review the mail etiquette.

Posted on: December 21, 2020

Articles from blogs I read

Cloud gaming review using Playstation Plus

# Introduction While testing the cloud gaming service GeForce Now, I've learned that PlayStation also had an offer. Basically, if you use a PlayStation 4 or 5, you can subscribe to the first two tiers to benefit some services and games library, but …

via Solene'% March 16, 2024

OpenSSH 9.7/9.7p1 released!

OpenSSH 9.7/9.7p1 has been released. The complete release notes may be found here: https://www.openssh.com/releasenotes.html#9.7p1 Read more…

via OpenBSD Journal March 12, 2024

crates.io: Download changes

Like the rest of the Rust community, crates.io has been growing rapidly, with download and package counts increasing 2-3x year-on-year. This growth doesn't come without problems, and we have made some changes to download handling on crates.io to ensur…

via Rust Blog March 11, 2024

Generated by openring