TOML frontmatter, can't end table, it puts everything after the table in the table

landings = ["general"]
[landing_weights]
general = 1

# Table should have ended.

thumbnail = "images/projects/underscoped.png"
image = "images/projects/underscoped.png"

Is there a way to fix this or do I have to wait till the bug is fixed.

that’s not a bug. its TOML design

put all toplevel values before the first table

Managed to fix the issue by adding [Params]

landings = ["general"]
[landing_weights]
general = 1

[Params]

thumbnail = "images/projects/underscoped.png"
image = "images/projects/underscoped.png"

even better.

you should also move the landings key to the params table.

toplevel custom params are deprecated in Hugo

This will only work for front matter provided by your theme.

Top level Hugo front matter will still not be recognized this way.

I don’t use a them, I rolled my own.
I am not sure I understand what you mean.
I would imagine every theme is beholdent to how hugo parses front matter.

An example with page front matter.

Suppose you want to set Hugo’s top level defined keys of title and description and the key landing_weights and thumbnail defined by you (or it could be a theme as mentioned in my last reply).

All keys are okay:

title = 'The title'
description = 'The description'
thumbnail = 'images/thumbnail.png'
[landing_weights]
  general = 1

This will work too:

title = 'The title'
description = 'The description'
[landing_weights]
  general = 1
[params]
  thumbnail = 'images/thumbnail.png'

This is not okay, `description’ will not be found

title = 'The title'
thumbnail = 'images/thumbnail.png'
[landing_weights]
  general = 1
[params]
  description = 'The description'
1 Like

And this is the preferred structure with v0.123.0 and later;

TOML:

title = "The title"
description = "The description"
[params]
thumbnail = "images/thumbnail.png"
[params.landing_weights]
general = 1

YAML:

title: The title
description: The description
params:
  thumbnail: images/thumbnail.png
  landing_weights:
    general: 1
1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.