Hello everyone, it me once again
A new day, a new problem and i really hope i didn’t overlook something simple onece again.
My Problem is that my header.html which includes my navbar doesn’t render my dropdown when im on a page which uses the single.html template.
It works fine on my index.html and i dont understand why it wouldn’t render.
Here is my Code:
{{ range $.Site.Pages }}
{{ if .Params.navbar }}
{{ if .Params.dropdown }}
<div class="dropdown">
{{ if $.Params.clickable }}
<li class="navbtn"><a href="{{ .URL }}/">{{ .Name }}</a></li>
{{ else }}
<li class="navbtn"><a href="#">{{ .Name }}</a></li>
{{ end }}
<div class="dropdown-content">
{{ range .Params.dropdown }}
<div class="col-md-6">
<h1>{{.}}</h1>
{{ range where $.Pages "Section" . }}
<a href="{{.RelPermalink}}">{{ .Title }}</a>
{{ end }}
</div>
{{ end }}
</div>
</div>
{{ else }}
<li class="navbtn"><a href="{{ .URL }}/">{{ .Name }}</a></li>
{{ end }}
{{ end }}
{{ end }}
It renders everything but the part in the {{ range where $.Pages “Section” . }}.
The only thing i can think of is that im ine the wrong scope but shouldn’t the $ get me to the top level again?.
Thanks in adavance
I’ve read the page you linked already but im still not understanding it.
In there it sais that this is the syntax: .Site.GetPage “/blog”
But because im already within a range
{{ range .Params.dropdown }}
I want to have it dynamic so that it ranges over my .dropdown with is an array with the names of the folders that i want to have shown.
$.Site.GetPage .
With my limited understanding this should go to the root level and grab the pages that are in my Dot. I have 2 Folders with i specified in the .dropdown array so i want to have:
Thats why i think that it just wont work range over it.
If i use with it only shows me the first entry of my array and puts an “s” behind the title and shows me a listpage which shows me my single pages within the folde rinstead of just the single pages.