hugo: Index | Files

package navigation

import ""


Package Files

menu.go pagemenus.go


var NopPageMenus = new(nopPageMenus)
type Menu []*MenuEntry

Menu is a collection of menu entries.

func (m Menu) Add(me *MenuEntry) Menu
func (m Menu) ByName() Menu

ByName sorts the menu by the name defined in the menu configuration.

func (m Menu) ByWeight() Menu

ByWeight sorts the menu by the weight defined in the menu configuration.

func (m Menu) Limit(n int) Menu

Limit limits the returned menu to n entries.

func (m Menu) Reverse() Menu

Reverse reverses the order of the menu entries.

func (m Menu) Sort() Menu

Sort sorts the menu by weight, name and then by identifier.

type MenuEntry struct {
    ConfiguredURL string // The URL value from front matter / config.
    Page          Page
    Name          string
    Menu          string
    Identifier    string

    Pre      template.HTML
    Post     template.HTML
    Weight   int
    Parent   string
    Children Menu
    // contains filtered or unexported fields

MenuEntry represents a menu item defined in either Page front matter or in the site config.

func (m *MenuEntry) HasChildren() bool

HasChildren returns whether this menu item has any children.

func (m *MenuEntry) IsEqual(inme *MenuEntry) bool

IsEqual returns whether the two menu entries represents the same menu entry.

func (m *MenuEntry) IsSameResource(inme *MenuEntry) bool

IsSameResource returns whether the two menu entries points to the same resource (URL).

func (m *MenuEntry) KeyName() string

KeyName returns the key used to identify this menu entry.

func (m *MenuEntry) MarshallMap(ime map[string]interface{})
func (m *MenuEntry) Title() string
func (m *MenuEntry) URL() string
type MenuQueryProvider interface {
    HasMenuCurrent(menuID string, me *MenuEntry) bool
    IsMenuCurrent(menuID string, inme *MenuEntry) bool

func NewMenuQueryProvider Uses

func NewMenuQueryProvider(
    setionPagesMenu string,
    pagem PageMenusGetter,
    sitem MenusGetter,
    p Page) MenuQueryProvider
type Menus map[string]Menu

Menus is a dictionary of menus.

type MenusGetter interface {
    Menus() Menus

type Page Uses

type Page interface {
    LinkTitle() string
    RelPermalink() string
    Section() string
    Weight() int
    IsPage() bool
    Params() maps.Params

A narrow version of page.Page.

type PageMenus map[string]*MenuEntry

PageMenus is a dictionary of menus defined in the Pages.

func PageMenusFromPage(p Page) (PageMenus, error)
type PageMenusGetter interface {
    Menus() PageMenus
type PageMenusProvider interface {

Package navigation imports 8 packages (graph) and is imported by 20 packages. Updated 2019-11-24. Refresh now. Tools for package owners.