sfrisk / webcomics-cms

a static site generator for webcomics
https://tavern-wenches.com
Other
21 stars 7 forks source link

ERROR render of "section" failed: execute of template failed #25

Closed WeyardWiz closed 2 years ago

WeyardWiz commented 3 years ago
C:\Hugo\Sites\webcomics-cms>hugo serve -D
Start building sites …
hugo v0.84.1-4BD65E22+extended windows/amd64 BuildDate=2021-06-24T11:44:23Z VendorInfo=gohugoio
ERROR 2021/06/27 17:13:54 render of "section" failed: execute of template failed: template: comic/list.html:3:5: executing "comic/list.html" at <partial "head.html" .>: error calling partial: "C:\Hugo\Sites\webcomics-cms\themes\webcomic\layouts\partials\head.html:14:96": execute of template failed: template: partials/head.html:14:96: executing "partials/head.html" at <.MediaType.Suffix>: can't evaluate field Suffix in type media.Type
ERROR 2021/06/27 17:13:54 render of "section" failed: execute of template failed: template: news/list.html:3:5: executing "news/list.html" at <partial "head.html" .>: error calling partial: "C:\Hugo\Sites\webcomics-cms\themes\webcomic\layouts\partials\head.html:14:96": execute of template failed: template: partials/head.html:14:96: executing "partials/head.html" at <.MediaType.Suffix>: can't evaluate field Suffix in type media.Type
ERROR 2021/06/27 17:13:54 render of "section" failed: execute of template failed: template: comic/list.html:3:5: executing "comic/list.html" at <partial "head.html" .>: error calling partial: "C:\Hugo\Sites\webcomics-cms\themes\webcomic\layouts\partials\head.html:14:96": execute of template failed: template: partials/head.html:14:96: executing "partials/head.html" at <.MediaType.Suffix>: can't evaluate field Suffix in type media.Type
ERROR 2021/06/27 17:13:54 render of "section" failed: execute of template failed: template: comic/list.html:3:5: executing "comic/list.html" at <partial "head.html" .>: error calling partial: "C:\Hugo\Sites\webcomics-cms\themes\webcomic\layouts\partials\head.html:14:96": execute of template failed: template: partials/head.html:14:96: executing "partials/head.html" at <.MediaType.Suffix>: can't evaluate field Suffix in type media.Type
Built in 169 ms
Error: Error building site: failed to render pages: render of "home" failed: execute of template failed: template: index.html:3:5: executing "index.html" at <partial "head.html" .>: error calling partial: "C:\Hugo\Sites\webcomics-cms\themes\webcomic\layouts\partials\head.html:14:96": execute of template failed: template: partials/head.html:14:96: executing "partials/head.html" at <.MediaType.Suffix>: can't evaluate field Suffix in type media.Type
WeyardWiz commented 3 years ago

ok so according to this post, I removed this line from C:\Hugo\Sites\webcomics-cms\themes\webcomic\layouts\partials\head.html

{{ printf.Rel .MediaType.Type .MediaType.Suffix .Permalink $.Site.Title | safeHTML }}

and the serve then worked!

I actually undid that change, and then just removed .MediaType.Suffix and even that worked.

But idk if that line is needed for something...i was able to launch the site just fine though without it...

benafischer94 commented 2 years ago

It looks like in Hugo .82 they moved .MediaType.Suffix to .MediaType.Suffixes So if you change it to:

{{ printf .Rel .MediaType.Type .MediaType.Suffixes .Permalink $.Site.Title | safeHTML }}

it will work again.

This can be useful for doing different rendering based on content type. Per the Original documentation here.

Some additional context on what the properties do. Note that MediaTypes.Suffixes is at the bottom.

I think originally the thought was only serve the most common suffix for the file type. Then to allow granularity on the different extensions a file type can use prompted the change to providing the full list.

sfrisk commented 2 years ago

Apparently I turned off my email notifications for github, so only just seeing this. I'll look at this this evening and make sure everything works with latest version of hugo with directions.

sfrisk commented 2 years ago

Okay, I've updated this repo to use Hugo 0.91.2 instead of Hugo 0.57.2 (which is what Netlify was configured to use). I've updated the readme to show the supported version of Hugo as well.