If I do an “OR”, it will always be true at least with the
- Because if
.TableOfContents is “”, it is not equal to the empty
- and if it is the empty
<nav> it is not equal to “”.
- if it has content, it is neither.
My version checks if it is not equal to the empty
<nav> AND not equal to “”. In that case it contains some navigational elements.
toc: false does only work if you use a conditional in your template. And since I have to use an if clause anyway, I thought I could just check for the empty
.TableOfContents and not force my users (me) to remember setting the front matter parameter.
What confused me was that on some pages it contained an empty
<nav> instead of being completely empty.
I do like your
with version, but since I am new to Hugo, I wasn’t sure how to use that yet. But after reading about it, I think the if clause just needs to have the dot too, not `.TableOfContents, right?