Hugo menu: Why does it not work?

Hi, i start to learn hugo and want to create my custom site.
In file config.toml i create a menu


identifier = "home"
name = "home"
url = "/"
weight = 1

identifier = "articles"
name = "articles"
url = "/articles/"
weight = 1

And in file header.html from the partials i display it
link to menu txt

But the menu is empty, why?

There is a typo in your range function.

In the provided part of the config you have specified the menu as menu.main yet in the linked PNG you are calling .Site.Menus.main

Hi, thanks for answer, but not Menu’s’ is the problem.

I change Menus to Menu and nothing not changed.

This is my repository, you can check what is my problem?

It seems that in your project the context for .Site is somehow lost.
I do not quite have the time to debug this for you, but you can render the menu with the global site function instead of using the .Site variable:

    {{ range site.Menus.main }}
    <li><a href="{{ .URL }}">{{ .Name }}</a></li>
    {{ end }}

Also note that / is not a valid baseURL. Use and similar.

Thank you. Its work.
But i want to use with the .Site variable, like in documentation.
And i can’t connect to the plugins.

{{ range .Site.Params.Plugins.css }}
    <link rel="stylesheet" href="{{ .link | absURL }} ">
{{ end }}

I came across the same issue and I found that the reason my menu was empty was that I was using a partial sidebar.html to construct my menu, and when I was referencing the partial I was forgetting to pass the page context. Here’s the relevant documentation on partials: Partial Templates | Hugo

In my case, in baseOf.html I changed:

{{ partial "sidebar" }}


{{ partial "sidebar" . }}

and my menu items started to correctly display with all context available