Search code examples
rr-markdownhugoblogdowntoml

blogdown indentation for TOML tables - in particular the default `config.toml` file


[params]
    description = "A website built through Hugo and blogdown."

    # options for highlight.js (version, additional languages, and theme)
    highlightjsVersion = "9.12.0"
    highlightjsCDN = "//cdnjs.cloudflare.com/ajax/libs"
    highlightjsLang = ["r", "yaml"]
    highlightjsTheme = "github"

    MathJaxCDN = "//cdnjs.cloudflare.com/ajax/libs"
    MathJaxVersion = "2.7.5"

    [params.logo]  # why is this indented?
    url = "logo.png"
    width = 50
    height = 50
    alt = "Logo"

The trailing end of the blogdown default config.toml file for the default hugo-lithium theme is shown above. I'm confused by the indentation of the [params.logo] table, five lines from the end of the file.

Shouldn't this [params.logo] table be non-indented? Why do I indent this [params.logo] table? Is it because it's a subset, and falls under the umbrella of the [params] table?

I can't find an explanation in blogdown's book, although it may be there and I missed it. I can't imagine the default files are wrong.

[params]
    description = "A website built through Hugo and blogdown."

    # options for highlight.js (version, additional languages, and theme)
    highlightjsVersion = "9.12.0"
    highlightjsCDN = "//cdnjs.cloudflare.com/ajax/libs"
    highlightjsLang = ["r", "yaml"]
    highlightjsTheme = "github"

    MathJaxCDN = "//cdnjs.cloudflare.com/ajax/libs"
    MathJaxVersion = "2.7.5"

[params.logo]  # shouldn't it be non-indented?
    url = "logo.png"
    width = 50
    height = 50
    alt = "Logo"

Solution

  • Indenting doesn't matter - see the toml spec

    In this case, it makes sense as a visual clue to the reader. params.logo is "under" params - the key logo is assigned a table as a value.