Documentation ¶
Overview ¶
Copyright 2021 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. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- type Menu
- type MenuEntry
- func (m *MenuEntry) HasChildren() bool
- func (m *MenuEntry) IsEqual(inme *MenuEntry) bool
- func (m *MenuEntry) IsSameResource(inme *MenuEntry) bool
- func (m *MenuEntry) KeyName() string
- func (m *MenuEntry) MarshallMap(ime map[string]interface{})
- func (m *MenuEntry) Title() string
- func (m *MenuEntry) URL() string
- type MenuQueryProvider
- type Menus
- type MenusGetter
- type Page
- type PageMenus
- type PageMenusGetter
- type PageMenusProvider
Constants ¶
This section is empty.
Variables ¶
var NopPageMenus = new(nopPageMenus)
Functions ¶
This section is empty.
Types ¶
type Menu ¶
type Menu []*MenuEntry
Menu is a collection of menu entries.
type MenuEntry ¶
type MenuEntry struct { ConfiguredURL string // The URL value from front matter / config. Page Page PageRef string // The path to the page, only relevant for site config. Name string Menu string Identifier string Pre template.HTML Post template.HTML Weight int Parent string Children Menu Params maps.Params // contains filtered or unexported fields }
MenuEntry represents a menu item defined in either Page front matter or in the site config.
func (*MenuEntry) HasChildren ¶
HasChildren returns whether this menu item has any children.
func (*MenuEntry) IsEqual ¶
IsEqual returns whether the two menu entries represents the same menu entry.
func (*MenuEntry) IsSameResource ¶
IsSameResource returns whether the two menu entries points to the same resource (URL).
func (*MenuEntry) MarshallMap ¶
type MenuQueryProvider ¶ added in v0.56.0
type MenuQueryProvider interface { HasMenuCurrent(menuID string, me *MenuEntry) bool IsMenuCurrent(menuID string, inme *MenuEntry) bool }
func NewMenuQueryProvider ¶
func NewMenuQueryProvider( pagem PageMenusGetter, sitem MenusGetter, p Page) MenuQueryProvider
type MenusGetter ¶
type MenusGetter interface {
Menus() Menus
}
type Page ¶
type Page interface { LinkTitle() string RelPermalink() string Section() string Weight() int IsPage() bool IsSection() bool IsAncestor(other interface{}) (bool, error) Params() maps.Params }
A narrow version of page.Page.
type PageMenusGetter ¶
type PageMenusGetter interface {
Menus() PageMenus
}
type PageMenusProvider ¶
type PageMenusProvider interface { PageMenusGetter MenuQueryProvider }