added more points to my note 'custom website generation'

This commit is contained in:
Abdullah Islam 2024-02-02 17:27:52 +06:00
parent e49e939f49
commit cd9997ecb0
1 changed files with 4 additions and 14 deletions

View File

@ -1,22 +1,12 @@
# Custom Website Generation
## Introduction
I thought it would be interesting to discuss how I generate the static pages that you see on this website. Instead of using a pre-existing static site generator, I decided to make my own system, using common UNIX tools.
I thought it would be interesting to discuss how I generate the static pages that you see on this website. Unlike others, I use a custom setup composed of make, awk, and shell, as none of the static site generators that I have seen directly use gemtext as their input format.
## Content Writing
First, I write the content in gemtext, allowing me to forget about styling. Since I am publishing to Gemini as well, Gemtext is more convenient then Markdown. The static pages shown to the public are generated using these source files.
First, I write the content in gemtext. gemtext seperates presentation from content (and doesn't have presentation at all), allowing me to focus on content while my build system takes care of presentation. Since I am publishing to Gemini as well, gemtext is more convenient, and translates better than markdown. The directory structure of the source directory directly translates to what you see online.
## Using make to build the website
Then, I use make to generate the static pages. make only executes a recipe if the files it requires have been changed. I was inspired by Karl Bartel's use of make:
=> https://www.karl.berlin/static-site.html Karl Bartel: 'make' as a Static Site Generator
Then, I use make to generate the static pages. make only executes a recipe if the files it requires have been changed. It is also very easy to add new rules.
## Using awk to process the source files
Most of the scripts run by make use awk, a language for processing text. I wrote some awk library scripts; I generally try to implement functions in awk, rather then execute programs, as the former is faster. I use mawk, since it's faster then gawk.
The html.awk script converts a gemtext file to HTML.
## Using git for tests
I have make recipes for conducting tests, which take in input files at testing/input, and generate output files at testing/output. git-status will show any changes in output, and may allow me to find out potential errors. I was, once again, inspired by Karl:
=> https://www.karl.berlin/testing-with-diff.html Karl Bartel: Simple Testing with 'git-diff'
## Related
=> http://git.vern.cc/techn0path/website
During the build process, make executes several scripts for awk, a language designed to process text. There are some awk library scripts that I wrote myself, as I generally try to implement functions in awk which are generally faster than executing external programs.