S.S. Law

This is a lightweight system/template for creating your own static website.

You create webpages in Markdown, in (your fork of) the repository (which you’ll have to commit and push if you’re using GitHub or GitLab as a host). Afterwards they’re converted and “stapled” together with ssg and lowdown, then more advanced editing is done on them with AWK scripts and finally everything is automatically “deployed”. All of those operations are done by a couple of shell scripts.

It is based upon the setup for my website, so if you want to see a more advanced generation configuration, with some already created AWK scripts, click here.

The goal of this template is to be as simple, understandable and expandable as possible. You’re highly encouraged to figure out what everything does and to modify it according to your needs. Everything that comes out of the box is just default configurations, remove what you don’t need and replace what you don’t like.

Contents

  1. How it all works and what are files for
    1. Scripts
    2. AWK
  2. How to use
    1. Configuring generate-site
  3. Background

How it all works and what are files for

The main tools that power everything are ssg, lowdown and awk. Essentially, ssg takes all of your website files, where

and puts everything in a nice folder (public). Afterwards, all AWK scripts are combined (which improves efficiency) into one and are ran on all .html files inside that folder.

Scripts

Inside the generate-scripts folder you’ll find the shell scripts, which automate the creation of your website. The get- scripts download and “install” ssg and lowdown, while generate-site.sh does the actual site generation.

.gitlab-ci.yml and .github/workflows/github-ci.yml are your pipeline configurations. With them GitLab and GitHub (respectively) can generate your site automatically, with their servers, and host it for you too. deploy.sh is a manual script which can be used to generate your site without GitHub or GitLab. All three use the stuff in generate-scripts. I’m encouraging you to remove the ones that you know you won’t need.

.ssgignore has files and folder which will not be used for site generation.

AWK

As mentioned, the preferred way to do special formatting to your generated (html) pages is via AWK scripts, because it’s decently simple and very powerful. An AWK script goes through the file, line by line, and then matches text patterns, which can then be processed any way you want (including modifying the current line).

An example use case would be to add your own syntax, lets say you want to type &&gb in Markdown, and in the HTML page that should be replaced with some HTML code, containing the image of the British flag. Or alternatively, what if you want to automatically insert an image next to every occurrence of a word, without having to specify it in the Markdown file.

Good resources for the language are

However, there are some caveats with the AWK scripts, in the context of this template:

How to use

There are 3 provided ways to (easily) generate it, using pipelines and scripts:

Configuring generate-site

There are a couple of variables which control how your website will be generated:

Depending on how you generate the website, those variables will be available/have to be modified either in:

Background

This template is pretty much my website generation stack, extracted as a standalone template, with some pipelines and nice default configurations. However, I was introduced to ssg and lowdown from Wolfgang’s Channel on YouTube, and more specifically, from his tutorial.

The name is a word-play on the main three technologies used: SSg, Lowdown, awk