Having an issue with footer menu

I have this menu defined in config.toml

[menu]
[[menu.nav]]
    identifier = "About"
    name = "About"
   pageref = "/about-us/"
    weight = 6

   [[menu.nav]]
    identifier = "Privacy"
    name = "Privacy"
    pageref = "/privacy-policy/"
    weight = 7

   [[menu.nav]]
    identifier = "Terms"
    name = "Terms"
    pageref = "/terms-of-service/"
    weight = 8
	
	[[menu.nav]]
    identifier = "Contact"
    name = "Contact"
    pageref = "/contact/"
    weight = 9

Called at the footer using this code

<nav class="footer-menu">
     <ul>
  {{ $currentPage := . }}
  {{ range site.Menus.nav }}
    {{ if $currentPage.IsMenuCurrent "nav" . }}
      <li class="active">
        <a href="{{ .URL }}">{{ .Name }} </a>
      </li>
    {{ else }}
      <li>
        <a href="{{ .URL }}">{{ .Name }}</a>
      </li>
    {{ end }}
  {{ end }}
</ul>
    </nav>

However, the menu shows empty links as shown here. I have tried different examples in the URL, but anything inside /.../ is not rendered, but anything inside /.../.../ is rendered. Using the latest version of Hugo and Go.

The pageref value must not have a trailing slash.

https://gohugo.io/variables/menus/#menu-entry-variables

site.GetPage will be used to do the page lookup.

1 Like

Something like /category/name/ works though. Is that a Hugo thing?

Section vs regular page…

content/
└── post/
    ├── _index.md
    └── test.md

Any of these will work to “get” content/post/test.md

{{ site.GetPage "test" }}
{{ site.GetPage "test.md" }}
{{ site.GetPage "post/test" }}
{{ site.GetPage "post/test.md" }}
{{ site.GetPage "/post/test" }}
{{ site.GetPage "/post/test.md" }}

Any of these will work to “get” content/post/_index.md

{{ site.GetPage "post" }}
{{ site.GetPage "/post" }}
{{ site.GetPage "/post/" }}
{{ site.GetPage "/post/_index.md" }}

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