c0_0p

smol_build.sh - A minimal HTML templating system

January 3rd, 2026

For my own purposes, I have created a very simple "templating engine" to build this website with. Compared to the features outlined in the Wikipedia link, this system hardly feels like it qualifies, but it suits my needs so far just fine.

You can check out the repository for this project here.

This tool is basically just a simple bash script that descends a project directory tree, along the way, it stacks layers of templating, generates .html files using the templating, and copies other static files to a build directory tree of the same structure.

The name

If you don't know what "smol" means, it's just a cutsie play on "small" that showed up around 2015. It hasn't made it into the dictionary (yet), but Merriam-Webster defines the slang as meaning "adorably small", and pronounced "smawl". (I know this flavour of slang or naming really aggravates some folks, oh well.

How it works

If you're still with me, then I'll quickly summarize how the tool works. You run the command with two options ./smol_build.sh [input_dir] [build_dir]. The command will recursively descend the input directory, every time it comes across a file named smol_template.html It will inject the contents into any previous templating at the point of the <smol_content/> tag. Any other .html files will have their content injected at this same tag and then an output file will be created in the build directory. Any other non html files in the input directory will be copied to the corresponding spot in the build directory.

For example:

For a file structure like this:

- /site/
 	- index.html
 	- smol_template.html
 	- /blog/
 		- smol_template.html
 		- index.html
 		- post_1.html

...where the files are as follows:

/site/smol_template.html

<html>
	<h1>Site Title</h1>
	<smol_content/>
</html>

/site/index.html

<p> Welcome to my home page!</p>

/site/blog/smol_template.html

<h2>Here is my blog</h2>
<smol_content/>

/site/blog/index.html

<h3>Posts:</h3>
<ul>
	<li> <a href="/blog/post1.html"> Post 1 </a> <li>
</ul>

/site/blog/post_1.html

<h3>Post #1</h3>
<p> Wow isn't this an interesting post!!!</p>

...the command ./smol_build.sh site build would build the following:

/build/index.html

<html>
	<h1>Site Title</h1>
	<p> Welcome to my home page!</p>
</html>

/build/blog/index.html

<html>
	<h1>Site Title</h1>
	<h2>Here is my blog</h2>
	<h3>Posts:</h3>
	<ul>
		<li> <a href="/blog/post1.html"> Post 1 </a> <li>
	</ul>
</html>

/build/blog/post_1.html

<html>
	<h1>Site Title</h1>
	<h2>Here is my blog</h2>
	<h3>Post #1</h3>
	<p> Wow isn't this an interesting post!!!</p>
</html>

Please note that the above example is accurate as of this posting, but check out the GitHub readme for more up to date documentation.

La Fin.

That's basically all there is to it, I hope to add a few more features in the future, such as a quiet mode, better validation of the option, and handling of CSS. If you end up using this for your own project, I'd love to hear from you. The best way to get in touch is probably Twitter.