[Solved]Cannot get navigation links to render using config.toml

Hi I am very new to Hugo. I am trying to get my navigation links to render in my navgation bar by using config.toml to store my data. I tried following this blog post about drop down menus but I could not figure it out.

Here is a link to the repo





Navbar Menus

name = “Home”
url = “”
weight = 1
name = “About”
url = “about”
weight = 2
name = “Portfolio”
url = “portfolio”
weight = 3
name = “Blog”
url = “blog”
weight = 4
name = “Get in touch”
url = “contact”
weight = 5

partial nav.html

<img src="{{ .Site.Params.logo | relURL }}" width="30" height="30">
<span class="navbar-toggler-icon"></span>
<ul class="navbar-nav ml-auto">

        {{ range .Site.Menus.nav}}

          <li class="nav-item">
    <a class="nav-link" href="/">{{.name}} </a>

Join MiR

This is what appears

Hi there,

Do you have your code in a repo somewhere we can have a look at? It is easier to help if we can replicate what you are trying to do. Have a read about Requesting Help

@pointyfar Hi, yes I do have a repo.
I created a new branch called menu.

Here is the link to the navigation code

Here is a link to the config.toml code

I’ll take a look at the requesting help article right now. Thank you

This line: https://github.com/zaynaib/mir_test/blob/menu/themes/basic/layouts/partials/nav.html#L17

should be

{{ .Name }}

note the uppercase N.

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

It’s still not working. I don’t think its recognizing .Site.Menus.nav variable. I tried changing line 17 to an uppercase N and nothing happened. Then I changed lines 16 - 18 to

    {{ range .Site.Menus.nav}}
          {{ . }}


to see if something appears and nothing is appearing in the navigation bar.

Okay. I deleted lines 16-18 and put in
{{ .Site.Menus}}

And it returned map[] So this means that it’s not recognizing my menu configuration.

I believe that I followed the directions from the docs when I set up my menu in config.toml. I guess I can try to generate it through the data folder. https://gohugo.io/content-management/menus/ and https://gohugo.io/templates/menu-templates/

@pointyfar I was not able to configure the menu using .toml. I was about to do it with a .yml file in the data folder. The way that map[] nested the data for my menu was odd.