The third time is a charm.


Ok, maybe this is the right time.

Let's restart writing about my endeavours in the coding, mathematical "geek" World, and honestly, everything else passing through my 'always in beta' mind. To explain what I mean by the "always in beta" mindset, it is simply my constant curiosity, always seeking improvement, and openness to change that guide my approach to coding, technical projects and almost everything else.

About this blog, I've moved it from a hosted version to GitHub pages with a static page generator, Hakyll (written in Haskell), then to Gitlab and now to another static page generator, written in Rust: introducing Cobalt.

What is Cobalt?

<from the Cobalt repo>: Cobalt is a straightforward static site generator written in Rust. Cobalt is simple, easy and fast. </repo>

With Cobalt, you can get up and running by simply installing the command-line tools (let's talk more about this later). This is thanks to a project design that focuses on simplicity and a comprehensive configuration with default values that work fine most of the time and can be customized to suit your needs afterwards.

Plus, it produces pages quickly, leveraging an engine written in Rust—a language I don't need to tell you anything about unless you were helping Elon Musk test life on Mars in the past eight years or so (check the analysis on the StackOverflow developers survey ).

Another good point about Cobalt, directly connected to simplicity, is the use of well-known technologies, like Liquid, for the frontend rendering, with some modifications for Rust: Liquid-Rust.

Before checking how to use it, a small negative note about Cobalt: it is VERY simple, practically bare! If you are like me, quite useless on the frontend design side, Cobalt could be "slightly" challenging.

Anyhow, some provided examples turned out to be very useful for a {full stack} \ {frontend} (Ed. Set notation) dev like me: check here

This blog is based on another blog source: booyaa, with already some minor customizations on my side, but we will talk about them in another post.

Using Cobalt

The Cobalt's documentation is thin, but this is not a problem because Cobalt is straightforward to use. To start blogging, install the binary, stand-alone...

$ curl -LSfs https://raw.githubusercontent.com/crate-ci/gh-install/master/v1/install.sh | sh -s -- --git cobalt-org/cobalt.rs --crate cobalt

... or using crates.io (requires Rust to be already installed, and to do so please always use rustup):

$ curl https://sh.rustup.rs -sSf | sh)

and then

$ cargo install cobalt-bin

Once installed, use the command line to create and manage your static website:

To create a new site in the name folder:

cobalt init

To add a page:

cobalt new "page name"

To test locally (localhost:1024)

cobalt serve

To list all the available commands:

cobalt --help cobalt help

and we can even trace and debug to see site information from the rendering engine

cobalt build --trace cobalt build --log-level... cobalt debug <collection/pages>

And that it is. With a few lines of code, Cobalt is installed and ready to generate a static website.

Happy hacking ;-)