DEV Community

Cover image for Building a website with Cobalt.rs
Dillon Fagan
Dillon Fagan

Posted on

Building a website with Cobalt.rs

I had considered making a blog/journal site for a while, but never found the time to work it into my already busy schedule.

But after doing some light research into the latest and greatest static site generators, I came across a unique specimen called Cobalt. Cobalt is essentially a re-implementation of Jekyll in Rust, but with its own unique quirks.

Cobalt Static Site Generator

Though Cobalt doesn't have the same maturity as Jekyll, I still find using it to be very enjoyable. It's also one of those situations where, as someone who appreciates what the Rust community is building, it can be worth sacrificing some convenience for the sake of supporting a cause.

When I had a problem with the where function in Liquid not working, I put up an issue on Cobalt's GitHub page and the maintainers added it in less than a day. This made me a very happy camper.

The setup

Installing Cobalt couldn't be more straight-forward. Assuming you have Rust installed, simply run the following:

curl -LSfs https://japaric.github.io/trust/install.sh | sh -s -- --git cobalt-org/cobalt.rs --crate cobalt

And that's it. Cobalt's installed.

To create a new site:

cobalt init <my-site-name>

cobalt init without a site name will initialize a new site in the current directory. With the name, it creates a directory for your site. It just works.

For designing and configuring your site, I recommend referring to their docs, which are fairly well written.

The takeaway

Is Cobalt mature enough to build a blog site?

Absolutely. It's super easy to build a blog with Cobalt.

Is Cobalt right for a business's website?

It's tough to say. Depending on what you want to implement on the site, it might be enough. It also might not be. Like Jekyll, Cobalt is blog-aware, which means that configurability is more limited than something like Hugo or Gatsby. I recommend at least pairing Cobalt with Netlify CMS, which gives the site a simple and convenient interface for non-coders.

Why would I choose Cobalt over Jekyll?

  1. You like to see your site built blazingly fast.
  2. You like Rust and the community that goes along with it.
  3. You like to support the underdog.
  4. You prefer simplicity over features-galore.

Discussion (0)