summaryrefslogtreecommitdiffstats
path: root/navigation
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-04-21 10:59:13 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-04-23 22:22:50 +0200
commit9a888c243adc2be4b630f29eac7def742803d8a4 (patch)
treefbb3bfed3b257c825ffb479550b06e2e010b63c6 /navigation
parent05b45c35c8067b7c4a6c99fec64f124739d2e7fd (diff)
Some godoc adjustments
Diffstat (limited to 'navigation')
-rw-r--r--navigation/menu.go54
1 files changed, 41 insertions, 13 deletions
diff --git a/navigation/menu.go b/navigation/menu.go
index 2693f0ac8..b9fb46e70 100644
--- a/navigation/menu.go
+++ b/navigation/menu.go
@@ -33,19 +33,44 @@ var smc = newMenuCache()
// MenuEntry represents a menu item defined in either Page front matter
// or in the site config.
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
- title string
- Pre template.HTML
- Post template.HTML
- Weight int
- Parent string
- Children Menu
- Params maps.Params
+ // The URL value from front matter / config.
+ ConfiguredURL string
+
+ // The Page connected to this menu entry.
+ Page Page
+
+ // The path to the page, only relevant for menus defined in site config.
+ PageRef string
+
+ // The name of the menu entry.
+ Name string
+
+ // The menu containing this menu entry.
+ Menu string
+
+ // Used to identify this menu entry.
+ Identifier string
+
+ title string
+
+ // If set, will be rendered before this menu entry.
+ Pre template.HTML
+
+ // If set, will be rendered after this menu entry.
+ Post template.HTML
+
+ // The weight of this menu entry, used for sorting.
+ // Set to a non-zero value, negative or positive.
+ Weight int
+
+ // Identifier of the parent menu entry.
+ Parent string
+
+ // Child entries.
+ Children Menu
+
+ // User defined params.
+ Params maps.Params
}
func (m *MenuEntry) URL() string {
@@ -170,6 +195,7 @@ func (m *MenuEntry) MarshallMap(ime map[string]any) error {
return nil
}
+// This is for internal use only.
func (m Menu) Add(me *MenuEntry) Menu {
m = append(m, me)
// TODO(bep)
@@ -271,6 +297,8 @@ func (m Menu) Reverse() Menu {
return menus
}
+// Clone clones the menu entries.
+// This is for internal use only.
func (m Menu) Clone() Menu {
return append(Menu(nil), m...)
}