Build options not working

I have several .md files in content/index/ and it’s sub-folders (separate from posts so as to keep things in order). I dont want these to show up in lists, so I have set in their front matter:

_build:
  list: 'false'
  publishResources: 'true'
  render: 'true'

Despite this, the pages turn up in lists. I’m not sure how to fix this, or even hot to start debugging this? I’d appreciate any tips!

I’m running a modified version of the theme hugo-xmag.

Remove the single quotation marks around true and false. render should be 'always'.

But you can simplify this by using front matter cascade, if you want all the articles under index not to appear in lists. Just add the code below to the _index.md file in the index folder

[[cascade]]
  [_build]
    list = false
    publishResources = true
    render = 'always'
2 Likes

Valid values for the list key are never, always, and local.

Valid values for the render key are never, always, and link.

list: never
publishResources: true
render: always

As @tut pointed out, never quote boolean values. That turns them into strings, which then evaluate as true.

And with YAML, you don’t need to quote strings unless one or more of the characters conflicts with YAML syntax.

1 Like

Thanks, removing the quotation marks around true and false fixed it. And I added the correct values too:

list: never
publishResources: true
render: always

I tried cascade in _index.md:

[[cascade]]
  [_build]
    list = never
    publishResources = true
    render = always

but I got this error in build:

failed to unmarshal YAML: yaml: unmarshal errors:
line 1: cannot unmarshal !!seq into map[string]interface {}

The YAML equivalent…

cascade:
  _build:
    - list: never
      publishResources: true
      render: always

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