This is the foss-north static site generator. Since I'm tired of Ruby, I decided to drop Jekyll and look into Jinja myself. This small setup allows me to create a data driven site from YAML files and Jinja templates.
The idea is to build the static site from a set of independent data driven sites, and at the same time encapsulate my way of working and eliminate most manual steps.
In the source
directory, all previous FOSS-North events have been
included as directories with git submodules (or simply with their
contents). Make sure to update image-conversions.conf
when adding
contents here.
Create a python3 venv using requirements.txt
.
Clone the static web repo as build
.
Run update-site.sh
.
The results end up in build
. Do git stuff to push to the server.
Each event may contain a tree of original images, commonly named
originals
. The convert-images.sh
script performs conversions based
on the image-conversions.conf
file. Each line in the conf
file is
interpreted as:
scope :
source :
destination :
size
The images are converted from source/
+ scope + /
+ source to
source/
+ scope + /
+ destination. All files are converted to
png
, resized and centered on a white background.
The remove-converted-images.sh
uses the same search algorithm as
convert-images.sh
but removes the destination files. Useful if you
want to avoid duplicating images.
The fn-generator.py
script takes two directories as arguments:
source base path and destination base path. The source directory is
expected to contain the following:
_source/
- source*.html
files. These are Jinja templates and each file results in the corresponding file being rendered to the_output/
directory._includes/
- includeable files. These are Jinja templates included or extended from the files in the_source/
directory._data/
- data set*.yaml
files. These files are exposed as variables under the globaldata
variable when rendering pages._assets/
- raw assets. This subtree is copied into the_output/
directory.
The result from processing these files are copied into the output directory.
When rendering the pages from the _source/
directory the global
variable data
is exposed to Jinja. This variable contains the
following sub-variables:
data.page
the name of the current page without file extension, e.g. when renderingindex.html
the variabledata.page
is set toindex
.data.pages
a list of all page names without file extensions.data.N
, where N corresponds to a YAML file from the_data/
directory. Each N the contains the contents of the associated YAML file.
The source code here is licensed under the Zero BSD license. Please see the LICENSE file for more information. The source code is copyright FOSS-North ek. för. Other content is copyright the respective owners.
Copyright(C) 2020 foss-north ek.för