digitalcraftsman / hugo-strata-theme

Port of HTML5UP's Strata theme to Hugo
Other
143 stars 92 forks source link

Errors on site without expected parameters set #48

Closed paskal closed 5 years ago

paskal commented 6 years ago

Hello!

$subj, when trying to run this theme against my blog source I get following (and it won't render at all):

Building sites … ERROR 2018/03/20 18:40:26 Error while rendering "page" in "": template: /srv/hugo/themes/strata/layouts/_default/single.html:5:5: executing "main" at <partial "post-meta" ...>: error calling partial: template: theme/partials/post-meta.html:2:50: executing "theme/partials/post-meta.html" at <.Site.Params.date_fo...>: invalid value; expected string
ERROR 2018/03/20 18:40:26 Error while rendering "page" in "post/": template: /srv/hugo/themes/strata/layouts/_default/single.html:5:5: executing "main" at <partial "post-meta" ...>: error calling partial: template: theme/partials/post-meta.html:2:50: executing "theme/partials/post-meta.html" at <.Site.Params.date_fo...>: invalid value; expected string
ERROR 2018/03/20 18:40:26 in .Render: Failed to execute template "theme/_default/summary.html": template: theme/_default/summary.html:6:7: executing "theme/_default/summary.html" at <partial "post-meta" ...>: error calling partial: template: theme/partials/post-meta.html:2:50: executing "theme/partials/post-meta.html" at <.Site.Params.date_fo...>: invalid value; expected string
WARNING: calling IsSet with unsupported type "invalid" (<nil>) will always return false.

ERROR 2018/03/20 18:40:26 Error while rendering "home" in "": template: /srv/hugo/themes/strata/layouts/index.html:15:5: executing "main" at <partial "contact" .>: error calling partial: template: theme/partials/contact.html:8:56: executing "theme/partials/contact.html" at <len .Site.Params.con...>: error calling len: len of untyped nil

The reason is likely some absent .Site. parameter but you can't tell it from error message, I guess input parameters handling could be improved. https://github.com/cboettig/hugo-now-ui/issues/9 might be used as reference point.

By the way, Site.Params.dateformat is used everywhere instead of Site.Params.date_format