[Solved] Nested YAML Params in front matter crash builds since 0.40

Since a few versions of Hugo, this YAML in a piece of content’s front matter triggers errors at build time:

---
banner: 
    src: banner.jpg
    alt: "Course banner: a jumping rabbit surrounded by Godot bot heads"
---

Results in:

ERROR 2018/04/28 13:14:44 Invalid banner in tutorial\game-design\godot\introduction-to-godot\index.md

There were no errors until Hugo… 0.37 maybe? And even with warnings in the console the server ran and the website built no problem. With hugo 0.40 it crashes builds however. The local server won’t run and these nested params also fail in TOML or JSON.

Was the support for nested params in a document’s front matter removed in a recent build? Anyone has an idea to fix the issue? These banners are the top picture you can see on the website and that also appear, blurred, in the header: http://gdquest.com/post/2018/03/godot-course-update-6/

Best,
Nathan

Publish here the template fragment that uses .Params.banner.

Also try to replace the quotes with single quotes.

That shouldn’t have been needed. The YAML looks fine.

If it was working before and then stopped working, this looks like a regression bug.

Can you provide a more thorough report?

  • Can you point to the repo that can be cloned to reproduce this error?
  • In which last version did it work?
  • In which first version did it start failing?
  • Is that the only error? Can you show more error details if there?
1 Like

@Mikhail The front matter alone triggers the error, it’s not linked to the templates as you can see from the error messages. Here’s my console after removing any calls to .Params.banner from the templates:

Single quotes, no quotes, double quotes is the same.

@kaushalmodi In hugo 0.36 and before it prints these errors buts the website builds no problem and the banners work. Getting the same errors after removing all trace of .Params.banner in the layouts. I hired a designer to work on the website but double checked with git and gitk: the yaml in the front matter has not changed, so I don’t know why the errors appeared.

I’m looking to open source the website and theme for fellow content creators, but gotta fix this first.

Here’s the repo if you want to check it out: https://github.com/GDquest/GDquest-website

And if you need anything I’m at your disposal :slight_smile:

I also added an issue to the repo so that the designer who made the changes can give it a look https://github.com/GDquest/GDquest-website/issues/36

Djrm found the issue: there was a taxonomy with the same name as the parameter and that’s what caused the issue

1 Like