mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-28 23:52:04 -05:00
hugolib: Improve error message on duplicate menu items
This commit is contained in:
parent
79a06aa4b6
commit
3a44920e79
1 changed files with 3 additions and 1 deletions
|
@ -28,6 +28,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/gohugoio/hugo/common/text"
|
"github.com/gohugoio/hugo/common/text"
|
||||||
|
|
||||||
"github.com/gohugoio/hugo/hugofs"
|
"github.com/gohugoio/hugo/hugofs"
|
||||||
|
@ -1438,7 +1440,7 @@ func (s *Site) assembleMenus() {
|
||||||
for _, p := range pages {
|
for _, p := range pages {
|
||||||
for name, me := range p.Menus() {
|
for name, me := range p.Menus() {
|
||||||
if _, ok := flat[twoD{name, me.KeyName()}]; ok {
|
if _, ok := flat[twoD{name, me.KeyName()}]; ok {
|
||||||
s.Log.ERROR.Printf("Two or more menu items have the same name/identifier in Menu %q: %q.\nRename or set an unique identifier.\n", name, me.KeyName())
|
s.SendError(p.errWithFileContext(errors.Errorf("duplicate menu entry with identifier %q in menu %q", me.KeyName(), name)))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
flat[twoD{name, me.KeyName()}] = me
|
flat[twoD{name, me.KeyName()}] = me
|
||||||
|
|
Loading…
Reference in a new issue