I am using a pretty bare-bones menu on my site, and upgrading to 0.55 broke some aspects of it. I’ll attempt to explain it as best I can here.
First my navigation.html partial:
<ul class="sdsw-navigation__list">
{{ $currentNode := . }}
{{ range .Site.Menus.main }}
{{ if .HasChildren }}
<li
class="sdsw-navigation__item sdsw-navigation__type{{ with .Page.Params.newsection }} new{{ end }} has-submenu{{if or ($currentNode.IsMenuCurrent "main" .) ($currentNode.HasMenuCurrent "main" .) ($currentNode.HasMenuCurrent "resources" .) ($currentNode.IsMenuCurrent "resources" .) }} open{{end}}">
<a href id="{{ lower .Name }}" aria-haspopup="true" aria-expanded="false">
{{ .Name | markdownify | title }}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">
<use xlink:href="#chevron" />
</svg>
</a>
<ul class="sdsw-navigation__sublist">
{{ range .Children }}
<li class="{{if or ($currentNode.IsMenuCurrent "main" .) ($currentNode.HasMenuCurrent "main" .) }}active{{ end }}{{ with .Page.Params.newpage }} new{{ end }}"
{{if or ($currentNode.IsMenuCurrent "main" .) ($currentNode.HasMenuCurrent "main" .) }} id="isCurrent" {{end}}>
<a href="{{ .URL }}">{{ .Name | markdownify | title }} </a>
</li>
{{ end }}
</ul>
</li>
{{ else }}
<li class="sdsw-navigation__item">
<a href="{{ .URL }}">{{ .Name | markdownify }} </a>
</li>
{{ end }}
{{ end }}
</ul>
Here are the problems I’m encountering:
- First, the above throws an error for all instances of single.html that says
execute of template failed: template: partials/navigation.html:24:77: executing "partials/navigation.html" at <.Params.newsection>: can't evaluate field Params in type *navigation.MenuEntry
- Changing
.Page.Params.newsection
to$.Page.Params.newsection
and.Page.Params.newpage
to$.Page.Params.newpage
lets the build go through with no errors. Is that what I should be doing? - Even though the site builds correctly, frontmatter
weight:
values are being ignored, and the pages are being listed alphabetically. This is changed since 0.55. - A content markdown file that lives directly under content/ that contains
menu:main
in its frontmatter is not being displayed at all in the menu. Again, this worked in 0.54.
I’m assuming .Page
is the culprit here since that looks to have been altered a bit in 0.55. Otherwise, everything else I’ve checked has matched the docs.
Any ideas here?