At the start of the week, I wrote down four high level goals:
- More Sectile improvements in Flourish live preview — ✅
- Finish restoring old content — ✅❌
- Improve MNF navigation — ❌
- Add 1 year of Eurovision data — ❌
Then I went to work improving the templating for this site, and any site that uses Flourish. One of the points of writing Flourish to generate static sites was to have much more control over the end result than any other static site generator I had looked at. At the core, I wanted these things:
- To have proper URLs for pages, and not have them ending in
.html— much as I wouldn't accept
/index.php, or a visible dispatcher being part of the path. But it is easy to either end a URL with
.html, or to cheat and create the pages as
index.htmland then only refer to the directory when working with static hosting.
- To create my own path structure — I didn't want to be locked into the
URL format, be it
/articles/post-slugor any other structure. I should be able to define and extend it, not have to accept only what the generator is capable of.
- To be able to add anything I could think of — (and write the code to generate, natch). It should be easy to create new pages, new features in pages, and new types of pages, ideally in a clear and relatively simple manner. Most generators have a plugin system, but many are limited in how that system can actually affect things. Or you end up jumping through hoops to do something that seems trivial at the outset.
- Different source types — I didn't want to have to use only Markdown files, or only YAML files, or only… This site is currently using a mixture of TOML, Markdown, and CSV files as the sources for the different types of content.
- Control over the output — that many generators come with easily replacable themes is great, but sometimes you are still locked into that. And more than once I've had a theme and a plugin disagree and have things break. I want to be able to write my own HTML. I used to be a professional web developer, after all.
Although it is not yet documented (like, at all, apart from the tests), the Sectile library I'm writing is for that last point. It is heavily inspired by how pages were generated by the publishing system in use at Yahoo! Europe when I joined, and the attempt to open source that logic into a new publisher, called r3 (now abandonware).
Briefly, how Sectile works is that you split up the page into many fragments ("sectility" is the ability of a mineral to be cut into thin pieces with a knife) with fragments including other fragments. Most templating systems allow you to include fragments, and even to create multi-level inheritance. Sectile differs from this in that rather than creating a specific tree of templates in advance, the template is assembled based upon what is known of the page, up to and including the full path. It can be hard to create specific templates or individual overrides to parts of pages in most template languages, it is nigh-on impossible to potentially do it for any given page on a site. Sectile allows this.
The hard part is being able to understand how the fragments are being assembled. In the live preview of Flourish I built a feature to look at the template and data that is used to create the current page (I call it the "blueprint", and it would be eerily familiar to any of the handful of people in the world who had built pages at Yahoo). When using Sectile this can be invaluable. But I wanted it to not just show me the fragments and final assembled page, but allow me to edit them (and eventually the page content, like a CMS).
I put together a short video demonstrating both the blueprint and how Sectile combines fragments depending on factors about the page, rather than in a strict hierarchy:
That's what I spent the most of the week doing, with underlying features added to Sectile to support improvements to the blueprint in Flourish. This made it much easier to rework the site to use Sectile better in advance of adding the older content.
Yes, this was all a way of procrastinating on something I've been putting off since starting this site redevelopment a year ago. But that was the last excuse gone, so I did get a fair amount of import work done on the old content over the weekend, just not finished.
And speaking of procrastination, I didn't add any Eurovision data either.