Hi,
I have the following front matter in YAML, but I would like express the same in TOML and JSON. I can’t seem to get either to work (hugo serve throws an error):
---
title: "Blog"
menu:
main:
identifier: 'posts'
weight: 10
---
Could someone provide me with an example in TOML and JSON formats?
Many thanks.
Thank you for the reply.
Indeed, I have tried this, but it does not work in front matter (at least for me), only in the config.
This is what I have tried (in the front matter):
+++
[menu]
[[menu.main]]
identifier = "about"
name = "about hugo"
pre = "<i class='fa fa-heart'></i>"
url = "/about/"
weight = -110
+++
Here is the error I get:
unable to process menus for "": unable to cast []map[string]interface {}{map[string]interface {}{"identifier":"about", "name":"about hugo", "pre":"<i class='fa fa-heart'></i>", "url":"/about/", "weight":-110}} of type []map[string]interface {} to map[string]interface{}
I believe that notation is for the config.toml file. Have a look at hugo convert toTOML - maybe create the frontmatter once in yaml and then convert to see what hugo is missing.
And try without the first [menu] and/or [menu.main] (one bracket).
Interesting that there seems to be NOWHERE with an example of frontmatter menus in TOML…
Excellent, that worked! Thank you!
Using hugo convert toTOML --unsafe converted:
---
title: "About"
menu:
main:
identifier: 'about'
weight: 10
---
to:
+++
title = "About"
[menu]
[menu.main]
identifier = "about"
weight = 10
+++
Great. Now I finally too know how to do that in TOML 