I’m a bit confused on how to use variables: I never get to use them as I’m expecting.
Here’s the first sample: I would like to add a class named like the section to the menù links.
My menù is the standard “partial”
<nav class="sidebar-nav">navbar
<ul>
{{ $currentNode := . }}
{{ range .Site.Menus.main }}
<li>
<a class=" sidebar-nav-item{{if or ($currentNode.IsMenuCurrent "main" .) ($currentNode.HasMenuCurrent "main" .) }} active{{end}} " href="{{.URL}}">
{{ .Section }} - {{ .Name }}
</a>
</li>
{{ end }}
</ul>
</nav>
and I’m trying to add the class with the same name of the section. For testing purpose I’m also trying to get the output on vidoe (close to the {{ .Name }}) but nothing works
{{ .Section }}
{{ .Params.Section }}
{{ .File. Section }} and so on… but hugo complains there’s no variable, or not function…
I really need a tutorial on how to use these - the manual is not enough for me.
Next a post on my second trouble, on accessing variables, too.
Please help, thank you.