Blogdown Breakdown

2019-04-25 A Memo To Self on A Blogdown Breakdown

Out of Cheese Error

At Unseen University in Ankh-Morpork, Ponder Stibbons and his students have built Hex, a thinking machine. Sometimes, something crucial goes ‘sproing!’ and Hex will report the helpful error message, ‘out of cheese error’. I felt a strong affinity this morning when I went to update this site with the slides from next week’s presentation in Stockholm.

The command to build the site is blogdown::build_site(). Normally, everything is tickety-boo, but THIS morning:

execute of template failed: template: partials/flex/body-aftercontent.html:40:9: executing "partials/flex/body-aftercontent.html" at <where .Site.Pages "S...>: error calling where: Source isn't a field of struct type *hugolib.Page

I spent a fruitless few minutes tinkering with things, before remembering the cardinal rule of error messages: google ‘em. I found this discussion which suggested looking through the theme templates for this line:

{{ range where .Site.Pages "Source.BaseFileName" $header }}

and replacing like so:

{{ range where .Site.Pages ".File.BaseFileName" $header }}

and

{{ range where .Site.Pages ".File.BaseFileName" $footer }}

…and that solved the problem. Apparently, something changed in the underlying Hugo site-building engine. Build a static website, they said. It’ll make life easier, they said…