josephhutch / aether

A responsive and clean Hugo theme for blogs
MIT License
146 stars 70 forks source link

Render fails if no "bgimg" setting #59

Closed snej closed 4 years ago

snej commented 4 years ago

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...

josephhutch commented 4 years ago

@snej Thank you for pointing this out! I just submitted a fix in afdc89a74ebc85b03bd12f0d38c4a6f0498b32dc. 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