+++*

Symbolic Forest

A homage to loading screens.

Blog : Page 22

We can rebuild it! We have the technology! (part three)

Introducing Pug

If you want to start reading this series of articles from the start, the first part is here. In the previous part we discussed how I adapted Wintersmith to my purposes, adding extra page generators for different types of archive page, and refactoring them to make sure that I wasn’t repeating the same logic in multiple places, which is always a good process to follow on any sort of coding project. This post is about the templating language that Wintersmith uses, Pug. When I say “that Wintersmith uses”, incidentally, you should always add a “by default” rider, because as we saw previously adding support for something else generally wouldn’t be too hard to do.

In this case, though, I decided to stick with Pug because rather than being a general-purpose templating or macro language, it’s specifically tailored towards outputting HTML. If you’ve ever tried playing around with HTML itself, you’re probably aware that the structure of an HTML document (or the Document Object Model, as it’s known) has to form a tree of elements, but also that the developer is responsible for making sure that it actually is a valid tree by ending elements in the right order. In other words, when you write code that looks like this:

<section><article><h2>Post title</h2><p>Some <em>content</em> here.</p></article></section>

it’s the developer who is responsible for making sure that those </p>, </article> and </section> tags come in the right order; that the code ends its elements in reverse order to how they started. Because HTML doesn’t pay any attention to (most) white space, they have to be supplied. Pug, on the other hand, enforces correct indentation to represent the tree structure of the document, meaning that you can’t accidentally create a document that doesn’t have a valid structure. It might be the wrong structure, if you mess up your indentation, but that’s a separate issue. In Pug, the above line of HTML would look like this:

section
  article
    h2 Post title
    p Some
      em content
      | here.

You specify the content of an element by putting it on the same line or indenting the following line; elements are automatically closed when you reach a line with the same or less indentation. Note that Pug also assumes that the first word on each line will be an opening tag, and how we can suppress this assumption with the | symbol. You can supply attributes in brackets, so an <a href="target"> ... </a> element becomes a(href="target") ..., and Pug also has CSS-selector-style shortcuts for the class and id attributes, because they’re so commonly used. The HTML code

<section class="mainContent"><article id="post-94">...</article></section>

becomes this in Pug:

section.mainContent
  article#post-94 ...

So far so good; and I immediately cracked on with looking at the pages of the old Wordpress blog and converting the HTML of a typical page into Pug. Moreover, Pug also supports inheritance and mixins (a bit like functions), so I could repeat the exercise of refactoring common code into a single location. The vast majority of the template code for each type of page sits in a single layout.pug file, which is inherited by the templates for specific types of page. It defines a mixin called post() which takes the data structure of a single post as its argument and formats it. The template for single posts is reduced to just this:

extends layout
block append vars
  - subHeader = '';
block append title
  | #{ ' : ' + page.title }
block content
  +post(page)

The block keyword is used to either append to or overwrite specific regions of the primary layout.pug template. The content part of the home page template is just as straightforward:

extends layout
block content
  each article in articles
    +post(article)

I’ve omitted the biggest part of the home page template, which inserts the “Newer posts” and “Older posts” links at the bottom of the page; you can see though that for the content block, the only difference is that we iterate over a range of articles—chosen by the page generator function—and call the mixin for each one.

The great thing about Pug, though, is that it lets you drop out into JavaScript at any point to run bits of code, and when doing that, you don’t just have access to the data for the page it’s working on, you can see the full data model of the entire site. So this makes it easy to do things such as output the sidebar menus (I say sidebar; they’re at the bottom if you’re on mobile) with content that includes things like the number of posts in each month and each category. In the case of the tag cloud, it effectively has to put together a histogram of all of the tags on every post, which we can only do if we have sight of the entire model. It’s also really useful to be able to do little bits of data manipulation on the content before we output it, even if it’s effectively little cosmetic things. The mixin for each post contains the following Javascript, to process the post’s categories:

- if (!Array.isArray(thePost.metadata.categories)) thePost.metadata.categories = [ thePost.metadata.categories ]
- thePost.metadata.categories = Array.from(new Set(thePost.metadata.categories))

The - at the start of each line tells Pug that this is JavaScript code to be run, rather than template content; all this code does is tidy up the post’s category data a little, firstly by making sure the categories are an array, and secondly by removing any duplicates.

You can, however, get a bit carried away with the JavaScript you include in the template. My first complete design for the blog, it turned out, took something like 90 minutes to 2 hours to build the site on my puny laptop; not really helpful if you just want to knock off a quick blog post and upload it. That’s because all of the code I had written to generate the tag cloud, the monthly menus and the category menus, was in the template, so it was being re-computed over again for each page. If you assume that the time taken to generate all those menus is roughly proportional to the number of posts on the blog, O(n) in computer science terms (I haven’t really looked into it—it can’t be any better but it may indeed be worse) then the time taken to generate the whole blog becomes O(n2), which translates as “this doesn’t really scale very well”. The garden blog with its sixtyish posts so far was no problem; for this blog (over 750 posts and counting) it wasn’t really workable.

What’s the solution to this? Back to the Wintersmith code. All those menus are (at least with the present design) always going to contain the same data at any given time, so we only ever need to generate them once. So, I created another Wintersmith plugin, cacher.coffee. The JavaScript code I’d put into my layout templates was converted into CoffeeScript code, called from the plugin registration function. It doesn’t generate HTML itself; instead, it generates data structures containing all of the information in the menus. If you were to write it out as JSON it would look something like this:

"monthData": [
  { "url": "2020/10/", "name": "October 2020", "count": 4 },
  { "url": "2020/09/", "name": "September 2020", "count": 9 },
  ...
],
"categoryData": [
  { "name": "Artistic", "longer": "Posts categorised in Artistic", "count": 105 },
  ...
],
"tagData": [
  { "name": "archaeology", "count": 18, "fontSize": "0.83333" },
  { "name": "art", "count": 23, "fontSize": "0.97222" },
  ...
]

And so on; you get the idea. The template then just contains some very simple code that loops through these data structures and turns them into HTML in the appropriate way for each site. Doing this cut the build time down from up to two hours to around five minutes. It’s still not as quick to write a post here as it is with something like Wordpress, but five minutes is a liveable amount of overhead as far as I am concerned.

The Plain People Of The Internet: So, you’re saying you got it all wrong the first time? Wouldn’t it all have been fine from the start if you’d done it that way to begin with?

Well, yes and no. It would have been cleaner code from the start, that’s for certain; the faster code also has a much better logical structure, as it keeps the code that generates the semantic content at arm’s length from the code that handles the visual appearance, using the data structure above as a contract between the two. Loose coupling between components is, from an architectural point of view, nearly always preferable than tight coupling. On the other hand, one of the basic principles of agile development (in all its many and glorious forms) is: don’t write more code than you need. For a small side project like this blog, the best course of action is nearly always to write the simplest thing that will work, be aware than you’re now owing some technical debt, and come back to improve it later. The difficult thing in the commercial world is nearly always making sure that that last part actually happens, but for a site like this all you need is self-discipline and time.

That just about covers, I think, how I learned enough Pug to put together the templates for this site. We still haven’t covered, though, the layout itself, and all the important ancillary stuff you should never gloss over such as the build-deploy process and how it’s actually hosted. We’ll make a start on that in the next post in this series.

*The next post in this series, in which we discuss responsive design, and using `npm` to make the build process more straightforward, is here*

The spread of death

Or, exploring some local history

Yesterday, after the rain had stopped, we went for a walk around Greenbank, the local Victorian garden cemetery. It’s a lovely place to visit whatever the weather, but on a cold day, after a rainstorm, with drips coming from every branch and all of the colours having a dark rain-soaked richness, it is a beautiful quiet place to wander around. Even when the children are pestering you to turn around and head back home so they can have some hot chocolate and watch TV. “It is a very hot chocolate sort of day,” said The Child Who Likes Fairies.

Wandering down the avenue

Exploring the graves

At the centre of Greenbank Cemetery is a connected pair of mortuary chapels: one for Anglicans, and a separate but identical one for other forms of Protestant. They have been derelict and fenced off for a long time, and their central wooden spire was taken down sixty or seventy years ago, but they are still surviving despite the failure of plans a few years ago to restore them and make them usable spaces once more. Above the entrance to the central atrium, between the two chapels, is a finely-carved inscription. “Opened 1871. Enlarged 1880.”

Greenbank Cemetery, Opened 1871, Enlarged 1880

Nowadays when you look at Greenbank on a map it’s surrounded in many places: by roads, by housing, on one side by a disused railway line. So I thought I’d dig into the archives to find out what its original groundplan was, and which parts were extended. Luckily, thanks to the fantastic work of Know Your Place Bristol and their maps, this was relatively straightforward to do. This first map is dated to 1880-81, so it seems to be after the first phase of enlargement of the cemetery. If you don’t know the area, note that it is bounded by an open stream to the west and north, and that Greenbank Road goes up to the cemetery gates and no further. I assume the original area of the cemetery was the part centred on the chapels, and the extension was the area east of the line of trees.

![Greenbank Cemetery, c. 1881](1_f_sm.png “Greenbank Cemetery, c. 1881”)

In many ways, even without the big garden cemetery this would be a typical landscape for the fringes of a growing Victorian city: a hotchpotch mixture of farmland and unplanned speculative terrace-building. There are rows of houses without proper streets in some parts, streets laid out without houses in others, and a city-sized workhouse with its own private burial ground behind it. If I’d extended the map to the north or to the south, you’d see a typical Victorian park: Eastville Park on one side and St George’s Park on the other.

If we skip forward thirty years or so, we can see how much the landscape has “filled out”. Moreover, we can see how the cemetery has been expanded to the west. The stream has been culverted; the land to the north and south of the cemetery has been taken by allotments. This map is from 1912; I’ve traced a map from 1902 which doesn’t show this, so we can assume this expansion took place some time in the Edwardian period, more or less.

![Greenbank Cemetery, c. 1912](2_f_sm.png “Greenbank Cemetery, c. 1912”)

In that thirty years huge parts of Easton which previously had just been sketched out for development have now become packed terraced streets, and some of the terraces which were built along narrow paths now have proper roads to them. Schools have been built, and a church. There’s a lot less open space, but there’s still some, here and there. Fishponds Road has acquired trams, up in the top-left corner; and the workhouse have stopped burying their dead on their own land.

If you know the area, though, you’ll know that it does still look a bit different today. To see the modern layout of the cemetery, we have to move forward to a 1950s map.

![Greenbank Cemetery, c. 1955](3_f_sm.png “Greenbank Cemetery, c. 1955”)

This is the boundaries of the cemetery as it is today. Greenbank Road has been extended, and Rose Green Road has been widened to take traffic. The cemetery has swallowed up the allotments on either side of it, stretching out to reach the roads. This must have happened some time after 1938, as a 6-inch-scale map revised that year still shows the allotments. However, it can’t have happened very long after, going by the dates of some of the graves on the ground. These sections of the cemetery include a number of graves from the Second World War, including civilian victims and enemy prisoners.

What’s always puzzled me about this, though, is that still to this day the emptiest parts of the cemetery include some of the areas which were included in the original 1871 cemetery right from its opening. The north-western side of the original cemetery, which slopes quite steeply down to the course of the brook which marked the original boundary, is still empty of graves. It’s one of the areas being used nowadays for interment, along the line of a path which was put in place when the cemetery first opened. Meanwhile, the late-Victorian and the 1930s extensions are jam-packed with graves, many of them now overgrown and abandoned.

This is the point at which a proper essay on local history would be drawing to a conclusion and discussing what conclusions we can draw about the growth of cemeteries in provincial English cities. As for me, I just like looking at old maps. I think it’s a fair assumption, though, that that city council deliberately bought additional land around the cemetery with the aim of expanding the cemetery into it when required, and in the interim used it for allotment space. Of course, I also like wandering round a cold, damp cemetery, too.

Greenbank Cemetery

Greenbank Cemetery

Greenbank Cemetery

At some point I’ll have to write more about that other burial ground marked on the map. That’s not just disused: for many years there was no sign of it at all on the ground, until a memorial was erected relatively recently. That, though, will be a story for another day.

Update, 2nd November 2020: We went back to Greenbank the other day, with my proper camera this time, to try to see if I could track on the ground any of the cemetery’s history of growth. Indeed, you can, if you know what to look for: however, it doesn’t quite marry up with the dates of the maps I’ve found. The new post about the cemetery’s history is here.

Too much to choose from

Or, why are there so many different trains in the world

Yesterday I said that having more blog posts about trains than about politics would be a good target to aim for by this time next year; and regardless of how frequently I post here overall, that’s probably still a good rule of thumb to aim for. So today, I thought I’d talk about model trains, and how I end up never building any.

I’ve always wanted a model train of some kind, ever since I was small and had a Hornby “Super Sound” trainset with an allegedly realistic chuff, generated by a sound machine wired in to the power circuity. However, there have always been a few problems with this, aside from the perennial problems of having enough time and space for such a space-gobbling hobby. There are two fundamental ones, at root: firstly, I am perennially pedantic, and secondly, I just like such a broad range of different railways and trains that it would be extremely hard to choose just one to stick with as a project. Given the first point, I would always want anything I build to be as accurate as I could make it; given the second, I can never stick with one idea for long enough to build enough stuff to practice the skills sufficiently and be a good enough model-builder to achieve this. Whilst drafting this post in my head, I tried to think just how many railways I’ve been interested in enough to start working out the feasibility of some sort of model railway project. It’s a long list.

  • Some sort of rural German branch line (I did actually start buying stock for this)
  • A fictitious narrow-gauge line in the Rhinogydd, in Ardudwy (again, this has reached the stock-acquiring level)
  • Grimsby East Marsh or somewhere else in Grimsby Docks
  • Something inspired by the Cambrian Railways’ coast section (although the actual stations are mostly fairly unattractive, apart from possibly Penrhyndeudraeth)
  • Woodhall Junction, on the Great Northern
  • Bala Junction (ever since I saw a plan of it in a Railway Modeller years and years ago)
  • Wadebridge (come on, who doesn’t like the North Cornwall Railway)
  • North Leith on the North British Railway (at 1:76 scale, you could do it to exact scale and it would still fit inside a 6 foot square)
  • Something fictitious based on the idea that the Lancashire, Derbyshire and East Coast Railway had actually finished their planned line east of Lincoln, which was always a wildly implausible plan in the real world.
  • The Rosedale Railway (although in practice this would probably be very dull as a model)
  • Moorswater, where the Liskeard and Looe Railway and Liskeard and Caradon Railways met (ideally when it was still in use as a passenger station, although that means before it was connected to the rest of the railway network)

Even for a modelling genius, or the sort of modeller who can produce an amazing, detailed landscape, then immediately packs it away in a box and starts working on the next one, that’s a lot of different ideas to vacillate between. And some of these would require just about everything on the model to be completely hand-made: Moorswater, for example, would have to have fully hand-made track, stock, locomotives and buildings in order to even vaguely resemble the original. With something like Woodhall Junction or Grimsby Docks most of the place-specific atmosphere is in the buildings rather than the trains, but even so, getting a good range of location-specific locos and stock would be difficult.

Just lately, there’s been another one to add to the list: I read a small book I picked up about the Brecon and Merthyr Railway, and was intrigued. I quickly found it had an intriguing range of operations, reached 1923 without ever owning any bogie coaches, and standardised on using somersault signals. The large-scale OS maps that are easily available (ie, those in the National Library of Scotland collection) show some very intriguing track layouts, its main locomotive works at Machen was an attractive and jumbled mix of 1820s stone and 1900s corrugated iron, and it even had some halts on the Machen-Caerffili branch which were only ever used by trains in one direction. However, on the other hand, the small book I picked up seems to be practically the only book ever written about the line, with very little information available easily about it. I suspect I’d end up writing a book about it myself before I got around to building anything.

I am going to try to build more models, and hopefully the more I build, the better they will get and the happier with my skills I’ll become. I’m going to have to try to stick to one and only one of the above, though, and try not to get distracted. That might be the hardest part.

The nightmare realms

Or, some things are too awful to talk about

Very long-term readers, or people who have gone delving around in the archives, might be aware that back when this site started, I used to talk about politics on a reasonably regular basis. Indeed, if you look in the menus (either down below or over on the right), you can see there’s a whole category for it. Since the restart, though, there really hasn’t been anything political that I have wanted to write about, or thought it worth writing about at all.

Fifteen years ago, British politics was in a pretty moribund state. The passion that led from getting a Labour government into power on a landslide win had faded. The Tories flailed aimlessly for a few years before settling on a leader with a shiny, plastic PR-friendly exterior and barely anything on the inside beyond a passionate over-confidence in his own ability. Labour were just…tired, fading away into a party mostly consisting of bland interchangeable technocrats. The feeling I had was: it didn’t matter back then what you thought about politics. Everything was just a bland porridge of centrist-looking parties not wanting to rock the boat, not doing anything too controversial or too likely to upset the press barons, mostly interested in finding some sort of grey consensus. There was a vague sense of religious morality underlying everything, a vague tinge of disapproval of anything sexual that wasn’t straight, cis and vanilla; but otherwise nobody seemed to have any passion or aims beyond their own careers.

I somehow predicted the planned outcome of the 2010 General Election five years ahead of time, and could see that the Tories were slowly and painfully pulling themselves apart as a party, but almost everything else I tried to predict about what might happen to the world, politically, turned out to be wrong. I suppose that’s still a better success rate than most political journalists who actually get paid to ramble, but nevertheless, I still feel as if maybe fifteen years ago I should have realised the extent of the precipice we were on, and just how far we were going to fall, when people realised just how to take advantage of the online world, and of the bland vacuity that was 2000s politics. I didn’t realise the Tories would keep themselves alive by trying to absorb every opinion to the right of them. Eight or nine years or so later, their ploys all played off, and we have been in the nightmare timeline ever since. We should have seen in coming.

So now, why would I want to write about politics, when it is worse, darker, more divisive, than anything I would have ever imagined? Fifteen years ago, you often would hear people saying they didn’t trust politicians, that they never told the truth, that no politician was ever honourable. People have taken advantage of that: if nobody ever trusted politicians, why should they even try to tell the truth? Why should they even try to behave with honour? In Britain the government has made it clear that laws are for others to obey and them to ignore, whether at the level of international relations or at the level of individuals. It seems pointless sometimes to point out just how poisonous this is. All we can do is try to still behave honourably ourselves. In this morning’s news, the American president has apparently come down with the ongoing pandemic disease, one that—given his age and ill health—has a high chance of either killing him outright or leaving him even more mentally impaired than he already is. Given he has recently claimed the disease is a hoax, given that by both accident and design he tells multiple lies every single day, it seems impossible, a few hours later, to tell whether he actually has it or not.

Hopefully, one day, there will be light on the horizon and politics will be boring again. Hopefully one day all the politicians will be interchangeably bland. Looking back, we didn’t realise just how lucky that was. Maybe my ambition for the first year of this blog’s relaunch should be to end up with more posts in the “Trains” category than the “Political” one, because those posts will be much more fun and healthier to both read and write.

We can rebuild it! We have the technology! (part two)

In which we delve into Wintersmith and some CoffeeScript

Previously, I discussed some various possible ways to structure the coding of a website, and why I decided to rebuild this site around the static site generator Wintersmith. Today, it’s time to dive a little deeper into what that actually entailed. Don’t worry if you’re not a technical reader; I’ll try to keep it all fairly straightforward.

To produce this website using Wintersmith, there were essential four particular technologies I knew I’d need to know. Firstly, the basics: HTML and CSS, as if I was writing every single one of the four-thousand-odd HTML files that currently make up this website from scratch. We’ll probably come onto that in a later post. Second-and-thirdly, by default Wintersmith uses Markdown to turn content into HTML, and Pug as the basis for its page templates. Markdown I was fairly familiar with as it’s so widely used; Pug was something new to me. And finally, as I said before, Wintersmith itself is written using CoffeeScript. I was vaguely aware that, out of the box, Wintersmith’s blog template wouldn’t fully replicate all of Wordpress’s features and I’d probably need to extend it. That would involve writing code, and when you’re extending an existing system, it’s always a good idea to try to match that system’s coding style and idioms. However, I’d come across CoffeeScript briefly a few years ago, and if you’ve used JavaScript, CoffeeScript is fairly straightforward to comprehend.

The Plain People Of The Internet: Hang on a minute there, now! You told us up there at the top, you were going to keep all this nice and straightforward for us non-technical Plain People. This isn’t sounding very non-technical to us now.

Ah, but I promised I would try. And look, so far, all I’ve done is listed stuff and told you why I needed to use it.

The Plain People Of The Internet: You’re not going to be enticing people to this Wintersmith malarkey, though, are you? Us Plain People don’t want something that means we need to learn three different languages! We want something nice and simple with a box on-screen we can write words in!

Now, now. I was like you once. I didn’t spring into life fully-formed with a knowledge of JavaScript and an instinctive awareness of how to exit Vim. I, too, thought that life would be much easier with a box I could just enter text into and that would be that. The problem is, I’m a perfectionist and I like the site to look just right, and for that you need to have some knowledge of HTML, CSS and all that side of things anyway. If you want your site to do anything even slightly out-of-the-ordinary, you end up having to learn JavaScript. And once you know all this, and you’re happy you at least know some of it, then why not go the whole hog and start knocking together something with three different programming languages you only learned last week? You’ll never know unless you try.

The Plain People Of The Internet: Right. You’re not convincing me, though.

Well, just stick with it and we’ll see how it goes.

In any case, I had at least come across CoffeeScript before at work, even if I didn’t use it for very much. It went through a phase a few years ago, I think, of almost being the next big language in the front-end space; but unlike TypeScript, it didn’t quite make it, possibly because (also unlike TypeScript) it is just that bit too different to JavaScript and didn’t have quite so much energy behind it. However, it is essentially just a layer on top of JavaScript, and everything in CoffeeScript has a direct JavaScript equivalent, so even if the syntax seems a bit strange at points it’s never going to be conceptually too far away from the way that JavaScript handles something. The official website goes as far as to say:

Underneath that awkward Java-esque patina, JavaScript has always had a gorgeous heart. CoffeeScript is an attempt to expose the good parts of JavaScript in a simple way.

Now if you ask me, that’s going a little bit far; but then, I don’t mind the “Java-esque patina” because the C-derived languages like C# and Java are the ones I’m happiest using anyway. CoffeeScript brings Python-style whitespace-significance to JavaScript: in other words, whereas in JavaScript the empty space and indentation in your code is just there to make it look pretty, in CoffeeScript it’s a significant part of the syntax. My own feeling on this, which might be controversial, is that the syntax of CoffeeScript is harder to read than the equivalent JavaScript. However, despite what some people will tell you, there’s no such thing as an objective viewpoint when it comes to language syntax; and as I said above, as Wintersmith is written in CoffeeScript, the best language to use to change and extend its behaviour is also CoffeeScript.

Wintersmith, indeed, is designed for its behaviour to be changeable and extendable. By default it only has a fairly small set of capabilities. It takes a “content tree”, a particular set of files and folders, and a set of templates. Markdown files in the content tree are converted to HTML, merged with a template, and written to an output file. JSON files are treated in almost the same way, almost as content files without any actual content aside from a block of metadata. Other filetypes, such as images, are copied through to the output unchanged. So, to take this article you’re reading as an example: it started out as a file called articles/we-can-rebuild-it-we-have-the-technology-part-two/index.md. That file starts with this metadata block, which as is normal for Markdown metadata, is in YAML:

---
title: We can rebuild it! We have the technology! (part two)
template: article.pug
date: 2020-09-28 20:09:00
...
---

I’ve configured Wintersmith to use a default output filename based on the date and title in the metadata of each article. This file, therefore, will be merged with the article.pug template and output as 2020/09/28/we-can-rebuild-it-we-have-the-technology-part-two/index.html, so its URI will nicely match the equivalent in Wordpress. So there you go, we have a page for each blog post, almost right out of the box.

That’s fine for individual article pages, but what about the home page of the blog? Well, Wintersmith is designed to use plugins for various things, including page generation; and if you create a new Wintersmith site using its blog template, you will get a file called paginator.coffee added to your site’s plugins folder, plus a reference in the site configuration file config.json to make sure it gets loaded.

"plugins": [
    "./plugins/paginator.coffee"
]

The code in paginator.coffee defines a class called PaginatorPage, which describes a page consisting of a group of articles. It then calls a Wintersmith API function called registerGenerator, to register a generator function. The generator function looks over every article in the content/articles folder, slices them up into blocks of your favoured articles-per-page value, and creates a PaginatorPage object for each block of articles. These are then output as index.html, page/2/index.html, page/3/index.html and so on. There, essentially, is the basis of a blog.

If you’ve used something like Wordpress, or if you’re a regular reader of this site, you’ll know most blogs have a bit more to them than that. They have features to categorise and file articles, such as categories and tags, and they also have date-based archives so it’s easy to, say, go and read everything posted in May 2008 or any other arbitrary month of your choice. Well, I thought, that’s straightforward. All we have to do there is to reuse the paginator.coffee plugin, and go in and fiddle with the code. So, I copied the logic from paginator.coffee and produced categoriser.coffee, archiver.coffee and tagulator.coffee to handle the different types of archive page. Pure copy-and-paste code would result in a lot of duplication, so to prevent that, I also created an additional “plugin” called common.coffee. Any code that is repeated across more than one of the page-generator plugins was pulled out into a function in common.coffee, so that then it can be called from anywhere in the generator code that needs it. Moreover, this blog and the garden blog are structured as separate Wintersmith sites, so I pulled out all of the CoffeeScript code (including the supplied but now much-altered paginator.coffee) into a separate shared directory tree, equally distant from either blog. The plugins section of the configuration file now looked like this:

"plugins": [
    "../shared/wintersmith/plugins/common.coffee",
    "../shared/wintersmith/plugins/paginator.coffee",
    "../shared/wintersmith/plugins/categoriser.coffee",
    "../shared/wintersmith/plugins/tagulator.coffee",
    "../shared/wintersmith/plugins/archiver.coffee"
]

The original paginator page generation function has now turned into the below: note how the only logic here is that which slices up the list of articles into pages, because everything else has been moved out into other functions. The getArticles function weeds out any maybe-articles that don’t meet the criteria for being an article properly, such as not having a template defined.

env.registerGenerator 'paginator', (contents, callback) ->
  articles = env.helpers.getArticles contents
  numPages = Math.ceil articles.length / options.perPage
  pages = []
  for i in [0...numPages]
    pageArticles = articles.slice i * options.perPage, (i + 1) * options.perPage
    pages.push new PaginatorPage i + 1, numPages, pageArticles
  env.helpers.pageLinker pages
  rv = env.helpers.addPagesToOutput pages, 'default'
  callback null, rv

This is the simplest of all the page-generators: the others have slightly more complex requirements, such as creating a fake “Uncategorised posts” category, or labelling the archive page for January 1970 as “Undated posts”.

There we go: my Wintersmith installations are now reproducing pretty much all of the different types of archive that Wordpress was handling dynamically for me before. The next time I come back to this topic, we’ll move onto the template side of things, including some nasty performance issues I found and then sorted out along the way.

*The next part of this post, in which we discuss website templating using Pug, is here*

Evidence of ritual activity

Neu, es i fwyta pysgod a sglodion

Sunday: a trip out to Stanton Drew stone circles. They are a mysterious and imposing group, relatively little-investigated and therefore with little certainty about them. The Great Circle, second in size only to Avebury, appears to be the remains of a complex henge monument containing multiple concentric circles of wooden posts and an avenue down to the nearby river: rather like Woodhenge, if you know it. The precise date or sequencing, though, is very unclear; it is almost certainly at least four thousand years old, possibly five thousand or more, a range of timescales which in the modern day would easily encompass both a medieval cathedral and the latest office blocks with a huge amount of room to spare.

Pointing to Stanton Drew

We have no real way of knowing what sort of rituals were held here, just that some sort of ritual presumably was, and that over time it will have changed radically. To the last prehistoric people to carry out a religious act here, it might have said to have been immeasurably old, here before the start of the universe; or it might have said to have been built just beyond the touch of living memory, in their fathers’ mothers’ fathers’ time. What we do know is that in reality it may well have been in continuous use for fifty generations or more. In that time there may have been considerable change in language, belief and ritual, or it may have been relatively static. Modern reconstructions of the site, which you can see on the English Heritage website, show an almost-alien forest of posts, completely foreign when compared to any modern-day religious rituals or structures.

Of course, people still carry out religious rituals at Stanton Drew today. They have no real relationship with the religion the site was originally built for, but they do have a deep spiritual and emotional connection to the site itself, as we today see it: to the land, the landscape, and the goddesses and gods that the people of today call upon.

Walking around and exploring the site, we looped around two-thirds of the Great Circle and wandered over to the North-East Circle, much smaller and on a much more human scale. It, too, had its avenue down to the river, and may have had some sort of four-post structure in its centre. Today, at its centre, we found a dead crow. Wrapped in black silk and placed there carefully face-down.

Crow in the circle

We had no way to tell if it had been sacrificed deliberately, or had died a natural death. We had no way to tell who had placed it there, or why, other than that they clearly cared, that it clearly meant something, to place it directly in the centre of the smallest circle, its head facing north. “Insects will eat it and turn it into a skeleton,” said The Child Who Likes Animals, and, indeed, we could see small flies on its soft feathers already getting to work and returning it to the soil. We stood back respectfully and let it go on its way, just as the brambles still ripening in the hedge at the corner of the field will in a few weeks time wither up probably still on the plant.

Stone circle brambles

And then, as it was barely even lunchtime, we headed off to the fish and chip restaurant at Chew Valley Lake to dine in style from cardboard boxes and with wooden forks.

Fish and chips

Hurrah, even if the peas are a bit too fancy to be proper mushy peas.

Black comedy

On death, and its absurdity

Almost a year ago, give or take a week or two, my dad died. I wrote, a few days later, about the experience, or at least part of it. Starting from being woken in the middle of the night by a phone call from the hospital, and ending with myself and The Mother walking out of the hospital, wondering what would happen next. I scribbled it down a few days later, after I had had a couple of days to process it, but whilst it was still relatively fresh in my head. The intention, naturally was to write more about the experience of being newly-bereaved, the dullness of the bureaucracy, of everyone else’s reactions to you, the hushed voices and awkward moments. Of course, none of that ever got written. Nothing even about his funeral. Much of it has now faded. I was thinking, though, now that I’ve relaunched this blog once more, maybe I should go back, go back over those few weeks last October, and try to remember exactly what it did feel like.

What first struck me at the time, though, is how darkly comic it all seems. I touched briefly in that previous post about some aspects of the bureaucracy, how hospital staff, when it happens, silently upgrade you to being allowed to use the staff crockery and unlimited biscuits, at the same time as quietly closing doors and shifting barriers around you to try to stop everyone else noticing there has been a death. Afterwards, though, it continues. The complex arrangements of paperwork that must be shuffled round to make sure the burial is done legally. The way customer service agents on the phone switch into their “condolences” voice, when for you it’s the fifth call of this type in a row and you just want to get them all over with. On that note, at some point I really should put together a list of how well- or badly-designed different organisations’ death processes are (the worst were Ovo, whose process involved sending The Mother a new contract that they had warned us would be completely wrong and should be ignored, but that they had to send out).

The peak of dark comedy, though, has to be everything around the funeral arrangements themselves. Right from our first visit to the funeral home, a tiny bungalow just next door to The Mother’s favourite Chinese takeaway. Like probably most funeral directors in the UK now, it used to be a little independent business but was swallowed up by one of the big national funeral chains when the owner retired. Because of this you can’t phone them up: all calls are routed via some impersonal national call centre. They have two people locally staffing the office, and they work alone, one week on, one week off. You have to admit that that’s a pretty good holiday allowance, but it is for a job in which you spend most of your time alone, apart from potentially with a corpse in the next room to keep you company. At the time of course, we knew none of this, so just decided to pop in to the office as we were passing on the way back from some other death-related trip.

Now, if I had written all this down at the time, or at least made notes, I’d have been able to recount exactly what was so strange about the little office. Such a hush inside, almost as if something had been planted in the walls to soak up sound. The cautious, tactful way the woman behind the desk asked how she could help us, and in my mind, the dilemma of how exactly to say. “We need to bury someone” just sounds that little bit too blunt, but equally, I didn’t want to dance around in circumlocutions all afternoon. She sat us down and took us through all the details, each one laid out in a glossy catalogue sent by Head Office. None of the prices, of course, were in the catalogue, and looking through I found it almost impossible to tell which ones were meant to be the cheap ones and which the expensive. Indeed, anything as vulgar as money was carefully avoided for as long as possible, and when it really had to be mentioned, the undertaker wrote down a few numbers on a piece of paper and passed it over to us, rather than do anything as shocking as say a price out loud.

The thing that I really couldn’t stop laughing at, though, I didn’t notice until after we took the brochures back to The Mother’s house. It was a small, three word sentence in the details of one particular coffin in the coffin catalogue.

Steel coffin

Yes, you can have a solid steel coffin if you like, in chunky thick blackened-finish steel. At a rough guess the steel in that coffin must weigh somewhere around 60 or 70 kilograms, so you might want to warn the pallbearers first. What made me laugh, though, is the thought that maybe, until they put that line in, someone somewhere didn’t realise that maybe it wasn’t a good idea to cremate a sheet steel coffin. Maybe they didn’t even realise until they opened the oven and found it, glowing a dull red still, all stubbornly in one piece, the contents turned to charcoal instead of burning.

Photo post of the week

In which we hunt for fossils

They do say that if you want to go looking for fossils on a beach, you should go in winter when storms disturb things or bring clifftops tumbling down. So just after Christmas, we went to Dunraven Bay, just near the mouth of the Afon Ogwr, because frankly if you want to be able to pick fossils up randomly off the sand on a beach, the coast of South Wales between Porthcawl and Cardiff is one of the best places in the world. Dunraven doesn’t just have fossils, though, it has a haunted garden. It did have a castle, but the castle was demolished in the 1960s, leaving behind the walled garden and the ghost that lives there.

Mossy trees

The walled garden

I'm not sure this is accurate

The cliffs of Dunraven Bay

Looking out to sea

Huge ammonite, over two feet across

Smaller ammonite with coin for scale

Running about on the beach

Sadly, I didn’t get a photo of the ghost.

Equal and returning

In which we pass a turning point

Autumn is almost here, although this year feels as if it didn’t really happen. I have been working away at a little desk in an eyrie of Symbolic Towers since March. At the start, I could see trains passing the end of the street; before long, they were hidden by the leaves on the trees, and soon, I will be able to see them again. In all that time, no time seems to have passed. At work staff have come and gone on my project, staff have come and gone in the wider company, we have rolled out major pieces of work into the real world, and in all that time, no time seems to have passed. The children have flipped back and forth between holidays, home-school, part-time school, and back at school again, and in all that time, no time seems to have passed. And tomorrow, the autumnal equinox is upon us.

Whether time will seem to start passing normally, of course, is another matter entirely. Right now, it seems like that won’t start happening for a long time on the human scale. On the scale of the stars, though, the world keeps turning, and the moon and the planets are still moving in the skies.

Maybe I will still be sitting at my desk in Symbolic Towers when the leaves start falling so I can see the passing trains again; and then when they start growing to conceal them next spring. We will see. I shall try to be optimistic, that the ever-turning world and the ever-turning skies show that life will endure, and that though some things will inevitably change, others will circle and return to their starting point.

Trains and levers

Or, a brief pause for relaxation

To the Severn Valley yesterday to play with trains, possibly for the last time in a while. I’m not on the roster for next month, and as the pandemic appears to be getting worse again, who knows what will happen after that point. The pandemic timetable makes it a quiet day, just four trains in each direction, and only one crossing move. Here it is, with one train waiting in the station and all the signals pulled off for the other to have a clear run through.

Signals off

In-between trains I sat and read a book of Victorian history, Mid-Victorian Britain 1851-75 by Geoffrey Body, and almost melted in the heat. It was windy outside, but hardly any of it came through the signalbox door. I watched a buzzard (I think) circling overhead, soaring slowly and sending the crows into a panic; heard pheasants and partridges squawking in the undergrowth, and listened to the frequent sound of semi-distant shotgun fire. It has been much in the news this week that shooting parties are allowed to be larger than other groups of people,* and all of the Very Online naturally have been joking about getting the guns in for their family parties; but yesterday in Shropshire and Worcestershire it felt as if people were genuinely doing just that, so frequent were the hunters’ gun-blasts.

And in small victories, at the end of the day I was proud. For I had filled in the Train Register for the day and not needed to cross any bits out. It may have been a quiet day with few trains and no unusual incidents to record; but, as I said, small victories.

Train register

When I was going through and reviewing all of the previous posts on here as part of the big rewrite, I realised the utter pointlessness of writing about some rubbish that’s on TV purely to say that I’m not going to watch it because it’s probably going to be rubbish. So, I’m not going to do that even though “some rubbish will be on TV in a few months” is all over the internet today. If you like watching rubbish then go and watch it, I’m not going to stop you. Me telling you I’m not is really just exclusionary boasting. So that’s that.

* Obviously, if you’re reading this now, just after I wrote it, you know this already. If it’s now five years in the future, you’ll have completely forgotten.