Templatable Pages with Gempost, the Gemini Static Site Generator

Published: 2024-12-06T09:35:36+01:00

I have been working on reworking Gempost.

Gempost is a static site generator that was created by JustLark.

I forked it quite a long time ago to modify it for my needs, the biggest change of which was adding pages support to the application, instead of just handling Gemlogs. I have now made a pretty major update to this pages functionality by turning pages into fully templatable gemtext Tera layout templates, similar to how Jekyll handles content.

You can find it here. (pagetemplatedir branch)

How does it work?

New Features

Layout Templates

The base.tera template is a common template that all pages use as a layout, unless overridden by the new layout option in the sidecar YAML file. A layout Tera template has the following available to it:

Page Templates

All pages (NOT posts! yet.) are themselves templatable, similar to how Jekyll handles HTML or Markdown content. They are handled as full Tera templates, which means all Tera features will work with them, including extends and includes.

The following variables are available to pages:

There is a new layout option available in the sidecar YAML for pages. It is the layout template to use. By default, if it's not specified, this will be “base”, which means it will read the base.tera file from the pages template directory specified in the gempost config file.

Better Error Reporting

I have also updated the error reporting during templating for pages. The application will now output exactly why a templating operation failed, rather than just the top-level (and usually unhelpful) error.

Where to go from here

It seems like gempost is pretty much abandoned, especially because JustLark's Gemini capsule is now offline. I am thinking about taking Gempost in a new direction, and unifying the features of pages and posts together. This will simplify my own site configuration, and I think make the tool more useful to people who want a more generalized static site generation solution for Gemini capsules.

Things I'm thinking about:

License: CC-BY-SA-4.0.

Written by: @[email protected]