josephhutch/aether

Render fails if no "bgimg" setting

Closed this issue · 1 comments

snej commented

The sample config in the README says

	bgimg = "Path, within the 'assets' folder, of the image used for the page background - optional"

However, it isn't optional -- if there is no bgimg entry in [params], rendering the site fails with a bunch of errors of the form:

Building sites … ERROR 2020/07/31 12:11:39 render of "page" failed: execute of template failed: template: _default/single.html:3:5: executing "_default/single.html" at <partial "head.html" .>: error calling partial: "/Users/snej/Websites/recordings/themes/aether/layouts/partials/head.html:36:19": execute of template failed: template: partials/head.html:36:19: executing "partials/head.html" at <resources.Get>: error calling Get: dirs not supported resource types: &{0xc00087e2b0 map[baseDir:/Users/snej/Websites/recordings/themes/aether/ filename:assets isOrdered:false lang: module:aether mountRoot: mountWeight:1 opener:0x4837490 watch:true]}

The error points to this line in partials/head.html:

  {{ with resources.Get .Site.Params.bgimg -}}

I'm not familiar with Hugo templates, but it looks as though it needs to test for the existence of the bgimg property before using it...

@snej Thank you for pointing this out! I just submitted a fix in afdc89a. Let me know if you have any other issues. I'm happy to help.

.. I should setup automated testing so this doesn't happen again