Minimal Jekyll Template that builds on Cloudflare Pages

For developers out there who like to start from scratch rather than with a fully styled special-purpose template. May also be useful for learning Jekyll in a structured way, i.e. what’s really Jekyll vs complicated configuration.

Basics

Consider a basic static website that consists of html, css, js and media files like images. They get served precisely as you wrote them (modulo your hoster compressing, injecting cookies, etc.).

Think of Jekyll as a superset of this world: Files still get served as-is, except for the following.

Files not served

Anything that has a name starting with _ won’t get served. This applies to both files (like _config.yml) and folders.

Files can also explicitly be ignored by listing them under field exclude in _config.yml.

Files getting processed

Files starting with YAML Front Matter get processed. This front matter can be empty, like on top of this very file here:

---
---

“Being processed” most notably means that one can use the Liquid templating language. index.md demonstrates how to refer to variables defined in _config.yml as well as in the front matter.

On top of that, some convenience file formats get compiled into their native counterparts, most notably:

Magic

Setting certain variables in _config.yml or in front matter result in behavior beyond what one would expect from reading the above (that they are set and can be referred to with Liquid). The exclude field mentioned above is one such example. There is a lot of this magic behavior, so online resources are crucial. Here are notable examples.

Layout

TODO

Cloudflare

Deploying GitHub projects on Cloudflare is free even for private repositories and comes with many perks. I find super fast load times around the globe and basic analytics (how many visitors and from where?) most valuable.

Similar to GitHub Pages, Cloudflare Pages will automatically build on each push. However, it also shows live logs of each build, which is useful for debugging!

Setup