Multiple config files and menu entries


#1

Initially, I opened https://github.com/gohugoio/hugo/issues/3879 because I thought it was a bug.

But after @bep’s comments it indeed seems like normal behavior.

Here’s is my use case:

config-common.yml:

menu:
    main:
        - Name: "A"
          URL: "https://foo.bar/"
          Weight: -10

And then I had this in config-development.yml

menu:
    main:
        - Name: "B"
          URL: "https://foo.bar/diff/" # this is different in config-pruduction.yml
          Weight: 0

And this is my template:

<ul class="nav navbar-nav">
    {{ $currentNode := . }}
    {{ range .Site.Menus.main }}
    <li class="nav-item{{ if $currentNode.IsMenuCurrent "main" . }} active{{ end }}">
        <a class="nav-link" href="{{ .URL }}">{{ .Name | safeHTML }}</a>
    </li>
    {{ end }}
</ul>

When I run Hugo with --config=config-common.yml,config-development.yml only the “B” menu is showing up; it’s like it overwrites config-common.yml's menu entry.

The other menu entries are defined in each page’s front matter and are common and they do show up fine.

So my question is, is there any way to have a different menu URL for the same menu entry in config.yml?

Thanks in advance!