diff options
Diffstat (limited to 'navigation')
-rw-r--r-- | navigation/menu.go | 7 | ||||
-rw-r--r-- | navigation/menu_cache.go | 6 | ||||
-rw-r--r-- | navigation/pagemenus.go | 2 |
3 files changed, 3 insertions, 12 deletions
diff --git a/navigation/menu.go b/navigation/menu.go index 50e51bcbe..3802014b1 100644 --- a/navigation/menu.go +++ b/navigation/menu.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Hugo Authors. All rights reserved. +// Copyright 2024 The Hugo Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -49,7 +49,6 @@ type MenuEntry struct { } func (m *MenuEntry) URL() string { - // Check page first. // In Hugo 0.86.0 we added `pageRef`, // a way to connect menu items in site config to pages. @@ -88,7 +87,7 @@ type Page interface { Weight() int IsPage() bool IsSection() bool - IsAncestor(other any) (bool, error) + IsAncestor(other any) bool Params() maps.Params } @@ -290,7 +289,6 @@ func DecodeConfig(in any) (*config.ConfigNamespace[map[string]MenuConfig, Menus] if err != nil { return ret, nil, err } else { - for _, entry := range m { var menuConfig MenuConfig if err := mapstructure.WeakDecode(entry, &menuConfig); err != nil { @@ -312,7 +310,6 @@ func DecodeConfig(in any) (*config.ConfigNamespace[map[string]MenuConfig, Menus] } return ret, menus, nil - } return config.DecodeNamespace[map[string]MenuConfig](in, buildConfig) diff --git a/navigation/menu_cache.go b/navigation/menu_cache.go index 4287ed875..b6350cd01 100644 --- a/navigation/menu_cache.go +++ b/navigation/menu_cache.go @@ -39,12 +39,6 @@ func newMenuCache() *menuCache { return &menuCache{m: make(map[string][]menuCacheEntry)} } -func (c *menuCache) clear() { - c.Lock() - defer c.Unlock() - c.m = make(map[string][]menuCacheEntry) -} - type menuCache struct { sync.RWMutex m map[string][]menuCacheEntry diff --git a/navigation/pagemenus.go b/navigation/pagemenus.go index 6321a8a63..ab57231c3 100644 --- a/navigation/pagemenus.go +++ b/navigation/pagemenus.go @@ -125,7 +125,7 @@ type pageMenus struct { func (pm *pageMenus) HasMenuCurrent(menuID string, me *MenuEntry) bool { if !types.IsNil(me.Page) && me.Page.IsSection() { - if ok, _ := me.Page.IsAncestor(pm.p); ok { + if ok := me.Page.IsAncestor(pm.p); ok { return true } } |