bashtille
This is my first project in the new domain. Feels good to be back!
This project started while I was developing ivndbt.com. But let's get back a little in the storyline.
When I was on rookiebwoy.eu, after an initial phase,
where I crafted every page by hand, I realized that this couldn't be the correct methodology.
Every time I had to edit something in the footer, for example, it required me to do it for every page individually.
In a small blog is boring but manageable, but in a bigger one this would become a nightmare.
That's how I switched to PHP.
As I was hosting everything on an Apache server I was able to include a couple of "common chunks of code" in the final page with:
<?php require_once($_SERVER['DOCUMENT_ROOT'].'/php/nav-menu.php'); ?>
This was a working solution, but not the cleanest one. Firstly because it gives an extra job to the server, slowing down page loads. Secondly, it requires a server that can execute PHP. My blog was simple enough to be static, but I didn’t know that was an option yet.
In the past few months, I got deeper into
the small web and I read a lot of
colophons where people describe their setups,
which made me aware that "static pages" were a thing, and that there are platforms to host them cheaper (or perhaps free)
than a dedicated server, such as
GitHub Pages,
Cloudflare Pages, or
Netlify.
Since I was planning to transfer my domain to a more personal one, I took the opportunity to experiment.
I had to solve the problem of updating multiple pages simultaneously.
Simpler solutions would have been to use an existing static site generator
(11ty for example) or to join some platforms like
Bear Blog or Blot.
However, I prefer building my own tools. (Sometimes) it's funny to reinvent the wheel!
That's how I came up with the idea of making my own static page generator.
I decided to code it in bash
because it's a default on most Linux systems.
While I know it's not the ideal language for this purpose,
it gives me the freedom to avoid libraries, virtual environments, and other complications.
KISS is the way!
If you ever crafted a website before, you should know that every page in the same domain usually shares some elements,
such as <head>
, <header>
, and <footer>
.
However, they aren't always "exactly" equal on every page.
In the <head>
especially sits some metadata that require specific descriptions to fit the content.
On this principle I've developed a bash script that uses a template.html
and does a substitution of all variables stored in .env
files.
For further information read the documentation in the
bashtille repository.
The substitution code wasn't particularly difficult.
The hardest challenge for me (as a noob) was figuring out how to replace multi-line variables (like the one in the <main>
tag).
Luckily my friend Pozzo found a clever solution!
After some tweaking, I added a sitemap generator too that scans all the pages.env
and assigns a priority based on the number of /
in the URL of that specific page.
Lastly, I have added an RSS feed generator to complete the suite.
To make it more usable it needs a unified command that launches all the scripts.
That's how I came up with the selector idea!
The name came from the first bash-related joke I came up with.
Plus I like the storming of the Bastille story.

*pretty image made on Carbon.