Use Yaml With Hugo

Why use YAML?

Using YAML with HUGO is a breeze. Hugo has supported yaml since 2013. and while TOML is the recommended configuration, I find YAML more readable. And I use YAML more often for other projects.

Thoughts on switching

Negatives: A lot of hugo documentation uses toml.

Postitives: Yaml seems to be winning the markdown language (2018). And I’ve been having to use Yaml with other projects. Hugo, is the only project I use that defaults to toml.

First, change your config.toml to config.yaml.

You can use an online convert like: https://toolkit.site/format.html

Which can turn this:

baseURL = "http://example.org/"
languageCode = "en-us"
title = "My New Hugo Site"

into this:

baseURL: 'http://example.org/'
languageCode: en-us
title: My New Hugo Site

Second Update your front matter and archtypes

Hugo’s front-matter (and archtypes) can use YAML also. To distinquish the differnce hugo uses:

TOML
identified by opening and closing +++.
YAML
identified by opening and closing ---.

see https://gohugo.io/content-management/front-matter/ for more information

References