mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-22 23:37:53 +00:00
menu: support nested Hugo menus #423
This commit is contained in:
parent
06e70da8a6
commit
79b43fcfce
45 changed files with 429 additions and 141 deletions
|
@ -31,8 +31,8 @@ The Relearn theme is an enhanced fork of the popular [Learn theme](https://githu
|
||||||
- [Chapter and site-wide printing capabilities](https://mcshelby.github.io/hugo-theme-relearn/configuration/sitemanagement/outputformats#print-support)
|
- [Chapter and site-wide printing capabilities](https://mcshelby.github.io/hugo-theme-relearn/configuration/sitemanagement/outputformats#print-support)
|
||||||
- [Versatile search options: in-page, popup, and dedicated search page](https://mcshelby.github.io/hugo-theme-relearn/configuration/sidebar/search)
|
- [Versatile search options: in-page, popup, and dedicated search page](https://mcshelby.github.io/hugo-theme-relearn/configuration/sidebar/search)
|
||||||
- [Customizable top bar buttons](https://mcshelby.github.io/hugo-theme-relearn/configuration/customization/topbar)
|
- [Customizable top bar buttons](https://mcshelby.github.io/hugo-theme-relearn/configuration/customization/topbar)
|
||||||
- [Nested navigation menu](https://mcshelby.github.io/hugo-theme-relearn/authoring/frontmatter/navigationmenu)
|
- [Nested menus](https://mcshelby.github.io/hugo-theme-relearn/authoring/frontmatter/navigationmenu)
|
||||||
- [Configurable menu shortcuts](https://mcshelby.github.io/hugo-theme-relearn/configuration/sidebar/shortcutmenu)
|
- [Configurable menus](https://mcshelby.github.io/hugo-theme-relearn/configuration/sidebar/shortcutmenu)
|
||||||
- [Support for hidden pages](https://mcshelby.github.io/hugo-theme-relearn/configuration/content/hidden)
|
- [Support for hidden pages](https://mcshelby.github.io/hugo-theme-relearn/configuration/content/hidden)
|
||||||
- [Comprehensive taxonomy support](https://mcshelby.github.io/hugo-theme-relearn/configuration/customization/taxonomy)
|
- [Comprehensive taxonomy support](https://mcshelby.github.io/hugo-theme-relearn/configuration/customization/taxonomy)
|
||||||
- [Social media integration](https://mcshelby.github.io/hugo-theme-relearn/configuration/sitemanagement/meta#social-media-images)
|
- [Social media integration](https://mcshelby.github.io/hugo-theme-relearn/configuration/sitemanagement/meta#social-media-images)
|
||||||
|
|
|
@ -310,6 +310,14 @@ a:focus,
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#R-sidebar .R-sidebarmenu > ul {
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
#R-sidebar .R-sidebarmenu > .nav-title ~ ul {
|
||||||
|
margin-top: .8rem;
|
||||||
|
}
|
||||||
|
|
||||||
#R-sidebar ul {
|
#R-sidebar ul {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
@ -2685,10 +2693,6 @@ body #R-logo svg * {
|
||||||
padding-bottom: 1rem;
|
padding-bottom: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
#R-topics {
|
|
||||||
padding-top: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
article .R-taxonomy ul,
|
article .R-taxonomy ul,
|
||||||
article .R-taxonomy li {
|
article .R-taxonomy li {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
|
|
|
@ -106,28 +106,30 @@ summaryLength = 10
|
||||||
landingPageName = '<i class="fa-fw fas fa-home"></i> Home'
|
landingPageName = '<i class="fa-fw fas fa-home"></i> Home'
|
||||||
|
|
||||||
[[languages.en.menu.shortcuts]]
|
[[languages.en.menu.shortcuts]]
|
||||||
name = '<i class="fa-fw fab fa-github"></i> GitHub Repo'
|
pre = '<i class="fa-fw fab fa-github"></i> '
|
||||||
identifier = 'ds'
|
name = 'GitHub Repo'
|
||||||
url = 'https://github.com/McShelby/hugo-theme-relearn'
|
url = 'https://github.com/McShelby/hugo-theme-relearn'
|
||||||
weight = 10
|
weight = 10
|
||||||
|
|
||||||
[[languages.en.menu.shortcuts]]
|
[[languages.en.menu.shortcuts]]
|
||||||
name = '<i class="fa-fw fas fa-camera"></i> Showcases'
|
name = 'Showcases'
|
||||||
pageRef = '/showcase'
|
pageRef = '/showcase'
|
||||||
weight = 20
|
weight = 20
|
||||||
|
|
||||||
[[languages.en.menu.shortcuts]]
|
[[languages.en.menu.shortcuts]]
|
||||||
name = '<i class="fa-fw fas fa-bullhorn"></i> Credits'
|
name = 'Credits'
|
||||||
pageRef = '/more/credits'
|
pageRef = '/more/credits'
|
||||||
weight = 30
|
weight = 30
|
||||||
|
|
||||||
[[languages.en.menu.shortcuts]]
|
[[languages.en.menu.shortcuts]]
|
||||||
name = '<i class="fa-fw fas fa-tags"></i> Tags'
|
pre = '<i class="fa-fw fas fa-tags"></i> '
|
||||||
|
name = 'Tags'
|
||||||
pageRef = '/tags'
|
pageRef = '/tags'
|
||||||
weight = 40
|
weight = 40
|
||||||
|
|
||||||
[[languages.en.menu.shortcuts]]
|
[[languages.en.menu.shortcuts]]
|
||||||
name = '<i class="fa-fw fas fa-layer-group"></i> Categories'
|
pre = '<i class="fa-fw fas fa-layer-group"></i> '
|
||||||
|
name = 'Categories'
|
||||||
pageRef = '/categories'
|
pageRef = '/categories'
|
||||||
weight = 50
|
weight = 50
|
||||||
|
|
||||||
|
@ -152,28 +154,30 @@ summaryLength = 10
|
||||||
landingPageName = '<i class="fa-fw fas home"></i> Arrr! Home'
|
landingPageName = '<i class="fa-fw fas home"></i> Arrr! Home'
|
||||||
|
|
||||||
[[languages.pir.menu.shortcuts]]
|
[[languages.pir.menu.shortcuts]]
|
||||||
name = '<i class="fa-fw fab fa-github"></i> GitHub Repo'
|
pre = '<i class="fa-fw fab fa-github"></i> '
|
||||||
identifier = 'ds'
|
name = 'GitHub Repo'
|
||||||
url = 'https://github.com/McShelby/hugo-theme-relearn'
|
url = 'https://github.com/McShelby/hugo-theme-relearn'
|
||||||
weight = 10
|
weight = 10
|
||||||
|
|
||||||
[[languages.pir.menu.shortcuts]]
|
[[languages.pir.menu.shortcuts]]
|
||||||
name = '<i class="fa-fw fas fa-camera"></i> Showcases'
|
pre = '<i class="fa-fw fas fa-camera"></i> '
|
||||||
|
name = 'Showcases'
|
||||||
pageRef = '/showcase'
|
pageRef = '/showcase'
|
||||||
weight = 20
|
weight = 20
|
||||||
|
|
||||||
[[languages.pir.menu.shortcuts]]
|
[[languages.pir.menu.shortcuts]]
|
||||||
name = '<i class="fa-fw fas fa-bullhorn"></i> Crrredits'
|
name = 'Crrredits'
|
||||||
pageRef = '/more/credits'
|
pageRef = '/more/credits'
|
||||||
weight = 30
|
weight = 30
|
||||||
|
|
||||||
[[languages.pir.menu.shortcuts]]
|
[[languages.pir.menu.shortcuts]]
|
||||||
name = '<i class="fa-fw fas fa-tags"></i> Arrr! Tags'
|
name = 'Arrr! Tags'
|
||||||
pageRef = '/tags'
|
pageRef = '/tags'
|
||||||
weight = 40
|
weight = 40
|
||||||
|
|
||||||
[[languages.pir.menu.shortcuts]]
|
[[languages.pir.menu.shortcuts]]
|
||||||
name = '<i class="fa-fw fas fa-layer-group"></i> Categorrries'
|
pre = '<i class="fa-fw fas fa-layer-group"></i> '
|
||||||
|
name = 'Categorrries'
|
||||||
pageRef = '/categories'
|
pageRef = '/categories'
|
||||||
weight = 50
|
weight = 50
|
||||||
|
|
||||||
|
|
|
@ -196,6 +196,13 @@ additionalContentLanguage = [ 'en' ]
|
||||||
# Menu
|
# Menu
|
||||||
# These options modify the menu appearance.
|
# These options modify the menu appearance.
|
||||||
|
|
||||||
|
# Shows checkmarks for visited pages of the main menu.
|
||||||
|
# Default: false
|
||||||
|
# This also causes the display of the `Clear History` entry in the lower part
|
||||||
|
# of the menu to remove all checkmarks. The checkmarks will also been removed
|
||||||
|
# if you regenerate your site as the ids are not stable.
|
||||||
|
showVisitedLinks = true
|
||||||
|
|
||||||
# Hide the Home entry.
|
# Hide the Home entry.
|
||||||
# Default: false
|
# Default: false
|
||||||
# If shown, a Home button will appear below the search bar and the main menu.
|
# If shown, a Home button will appear below the search bar and the main menu.
|
||||||
|
@ -225,19 +232,6 @@ alwaysopen = ''
|
||||||
# This can be overridden in the page's frontmatter.
|
# This can be overridden in the page's frontmatter.
|
||||||
collapsibleMenu = true
|
collapsibleMenu = true
|
||||||
|
|
||||||
# Shows checkmarks for visited pages of the main menu.
|
|
||||||
# Default: false
|
|
||||||
# This also causes the display of the `Clear History` entry in the lower part
|
|
||||||
# of the menu to remove all checkmarks. The checkmarks will also been removed
|
|
||||||
# if you regenerate your site as the ids are not stable.
|
|
||||||
showVisitedLinks = true
|
|
||||||
|
|
||||||
# Hide heading above the shortcut menu.
|
|
||||||
# Default: false
|
|
||||||
# The title for the heading can be overwritten in your i18n files. See Hugo's
|
|
||||||
# documentation how to do this.
|
|
||||||
disableShortcutsTitle = false
|
|
||||||
|
|
||||||
# Hide the language switcher.
|
# Hide the language switcher.
|
||||||
# Default: false
|
# Default: false
|
||||||
# If you have more than one language configured, a language switcher is
|
# If you have more than one language configured, a language switcher is
|
||||||
|
@ -245,6 +239,45 @@ disableShortcutsTitle = false
|
||||||
# turn this behavior off.
|
# turn this behavior off.
|
||||||
disableLanguageSwitchingButton = false
|
disableLanguageSwitchingButton = false
|
||||||
|
|
||||||
|
# Hide heading above the shortcuts menu.
|
||||||
|
# Default: false
|
||||||
|
# If a sidebar menu with identifier `shortcuts` is configured (see below),
|
||||||
|
# this is the easy way to remove the heading;
|
||||||
|
# The title for the heading can be overwritten in your i18n files. See Hugo's
|
||||||
|
# documentation how to do this.
|
||||||
|
disableShortcutsTitle = false
|
||||||
|
|
||||||
|
# Define your own sidebar menus.
|
||||||
|
# Default: the value used below
|
||||||
|
# The sidebar menus are built from this parameter. If not set, it contains
|
||||||
|
# the below default.
|
||||||
|
# Menus are written from the sidebar's top to buttom in the order given in
|
||||||
|
# this array.
|
||||||
|
# This can be overridden in the page's frontmatter.
|
||||||
|
# Each entry can contain the following keys:
|
||||||
|
# - `type` is mandatory. Either `page` in case it should generate a tre from
|
||||||
|
# the page structure or `menu` in case it should generate a tree from a
|
||||||
|
# defined menu.
|
||||||
|
# - `identifier` is mandatory. In case of `type=page`, anything can be used,
|
||||||
|
# in case of `type=menu` the `identifier` key must be identical to the
|
||||||
|
# key of the menu definition.
|
||||||
|
# - `main`, boolean. If `true`, the first tree level is spaced more generous
|
||||||
|
# and the text is emphasized. Default: `true` for `type=page` and `false`
|
||||||
|
# for `type=menu`
|
||||||
|
# - `disableTitle`, boolean. If `true`, there is no title above the tree.
|
||||||
|
# Default: `true` for `type=page` and `false` for `type=menu`. If a title
|
||||||
|
# should be used, in case of `type=page` it will be taken from the page's
|
||||||
|
# `menuTitle` front matter and if not set, from the translation files, using
|
||||||
|
# the menu `identifier` as key. In case of `type=menu` it will be taken
|
||||||
|
# from the menu `title` according to Hugo's documentation and if not set
|
||||||
|
# from the menu `name` and if this is not set form the page's `linkTitle`.
|
||||||
|
# - `pageRef`, optional. In case of `type=page` this is the starting page's
|
||||||
|
# path. If not set, the home page will be used.
|
||||||
|
sidebarmenus = [
|
||||||
|
{ type = 'page', identifier = 'home', main = true, disableTitle = true, pageRef = '' },
|
||||||
|
{ type = 'menu', identifier = 'shortcuts', main = false, disableTitle = false },
|
||||||
|
]
|
||||||
|
|
||||||
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
# Hidden pages
|
# Hidden pages
|
||||||
# These options configure how hidden pages are treated.
|
# These options configure how hidden pages are treated.
|
||||||
|
|
|
@ -99,7 +99,6 @@ To stay with the [initial example](authoring/structure): Suppose you want `first
|
||||||
For this, open `content/first-chapter/first-page/_index.md` and add the following front matter
|
For this, open `content/first-chapter/first-page/_index.md` and add the following front matter
|
||||||
|
|
||||||
{{< multiconfig fm=true >}}
|
{{< multiconfig fm=true >}}
|
||||||
collapsibleMenu = true
|
|
||||||
[_build]
|
[_build]
|
||||||
render = 'never'
|
render = 'never'
|
||||||
{{< /multiconfig >}}
|
{{< /multiconfig >}}
|
||||||
|
|
|
@ -115,6 +115,36 @@ alwaysopen = ''
|
||||||
# If not set, the set value of your site's hugo.toml is used.
|
# If not set, the set value of your site's hugo.toml is used.
|
||||||
collapsibleMenu = true
|
collapsibleMenu = true
|
||||||
|
|
||||||
|
# Define your own sidebar menus.
|
||||||
|
# Default: the value used below
|
||||||
|
# The sidebar menus are built from this parameter. If not set, the set value
|
||||||
|
# of your site's hugo.toml is used and contains the below default.
|
||||||
|
# Menus are written from the sidebar's top to buttom in the order given in
|
||||||
|
# this array.
|
||||||
|
# Each entry can contain the following keys:
|
||||||
|
# - `type` is mandatory. Either `page` in case it should generate a tre from
|
||||||
|
# the page structure or `menu` in case it should generate a tree from a
|
||||||
|
# defined menu.
|
||||||
|
# - `identifier` is mandatory. In case of `type=page`, anything can be used,
|
||||||
|
# in case of `type=menu` the `identifier` key must be identical to the
|
||||||
|
# key of the menu definition.
|
||||||
|
# - `main`, boolean. If `true`, the first tree level is spaced more generous
|
||||||
|
# and the text is emphasized. Default: `true` for `type=page` and `false`
|
||||||
|
# for `type=menu`
|
||||||
|
# - `disableTitle`, boolean. If `true`, there is no title above the tree.
|
||||||
|
# Default: `true` for `type=page` and `false` for `type=menu`. If a title
|
||||||
|
# should be used, in case of `type=page` it will be taken from the page's
|
||||||
|
# `menuTitle` front matter and if not set, from the translation files, using
|
||||||
|
# the menu `identifier` as key. In case of `type=menu` it will be taken
|
||||||
|
# from the menu `title` according to Hugo's documentation and if not set
|
||||||
|
# from the menu `name` and if this is not set form the page's `linkTitle`.
|
||||||
|
# - `pageRef`, optional. In case of `type=page` this is the starting page's
|
||||||
|
# path. If not set, the home page will be used.
|
||||||
|
sidebarmenus = [
|
||||||
|
{ type = 'page', identifier = 'home', main = true, disableTitle = true, pageRef = '' },
|
||||||
|
{ type = 'menu', identifier = 'shortcuts', main = false, disableTitle = false },
|
||||||
|
]
|
||||||
|
|
||||||
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
# Hidden pages
|
# Hidden pages
|
||||||
# These options configure how hidden pages are treated.
|
# These options configure how hidden pages are treated.
|
||||||
|
|
|
@ -24,7 +24,7 @@ You can disable this title with `disableShortcutsTitle=true`.
|
||||||
To change the title, update your local i18n translation file.
|
To change the title, update your local i18n translation file.
|
||||||
|
|
||||||
````toml {title="i18n/en.toml"}
|
````toml {title="i18n/en.toml"}
|
||||||
[Shortcuts-Title]
|
[shortcuts-menuTitle]
|
||||||
other = "Other Great Stuff"
|
other = "Other Great Stuff"
|
||||||
````
|
````
|
||||||
|
|
||||||
|
@ -34,31 +34,32 @@ Edit `hugo.toml` and add `[[menu.shortcuts]]` entries for each link:
|
||||||
|
|
||||||
{{< multiconfig file=hugo >}}
|
{{< multiconfig file=hugo >}}
|
||||||
[[menu.shortcuts]]
|
[[menu.shortcuts]]
|
||||||
name = '<i class="fa-fw fab fa-github"></i> GitHub Repo'
|
pre = '<i class="fa-fw fab fa-github"></i> '
|
||||||
identifier = 'ds'
|
name = 'GitHub Repo'
|
||||||
url = 'https://github.com/McShelby/hugo-theme-relearn'
|
url = 'https://github.com/McShelby/hugo-theme-relearn'
|
||||||
weight = 10
|
weight = 10
|
||||||
|
|
||||||
[[menu.shortcuts]]
|
[[menu.shortcuts]]
|
||||||
name = '<i class="fa-fw fas fa-camera"></i> Showcases'
|
name = 'Showcases'
|
||||||
pageRef = '/showcase'
|
pageRef = '/showcase'
|
||||||
weight = 11
|
|
||||||
|
|
||||||
[[menu.shortcuts]]
|
|
||||||
name = '<i class="fa-fw fas fa-bookmark"></i> Hugo Documentation'
|
|
||||||
identifier = 'hugodoc'
|
|
||||||
url = 'https://gohugo.io/'
|
|
||||||
weight = 20
|
weight = 20
|
||||||
|
|
||||||
[[menu.shortcuts]]
|
[[menu.shortcuts]]
|
||||||
name = '<i class="fa-fw fas fa-bullhorn"></i> Credits'
|
name = 'Credits'
|
||||||
pageRef = '/more/credits'
|
pageRef = '/more/credits'
|
||||||
weight = 30
|
weight = 30
|
||||||
|
|
||||||
[[menu.shortcuts]]
|
[[menu.shortcuts]]
|
||||||
name = '<i class="fa-fw fas fa-tags"></i> Tags'
|
pre = '<i class="fa-fw fas fa-tags"></i> '
|
||||||
|
name = 'Tags'
|
||||||
pageRef = '/tags'
|
pageRef = '/tags'
|
||||||
weight = 40
|
weight = 40
|
||||||
|
|
||||||
|
[[menu.shortcuts]]
|
||||||
|
pre = '<i class="fa-fw fas fa-layer-group"></i> '
|
||||||
|
name = 'Categories'
|
||||||
|
pageRef = '/categories'
|
||||||
|
weight = 50
|
||||||
{{< /multiconfig >}}
|
{{< /multiconfig >}}
|
||||||
|
|
||||||
## Multilingual Example
|
## Multilingual Example
|
||||||
|
@ -73,32 +74,33 @@ For multilingual sites, set different menus for each language in `hugo.toml`:
|
||||||
languageName = 'English'
|
languageName = 'English'
|
||||||
|
|
||||||
[[languages.en.menu.shortcuts]]
|
[[languages.en.menu.shortcuts]]
|
||||||
name = '<i class="fa-fw fab fa-github"></i> GitHub Repo'
|
pre = '<i class="fa-fw fab fa-github"></i> '
|
||||||
identifier = 'ds'
|
name = 'GitHub Repo'
|
||||||
url = 'https://github.com/McShelby/hugo-theme-relearn'
|
url = 'https://github.com/McShelby/hugo-theme-relearn'
|
||||||
weight = 10
|
weight = 10
|
||||||
|
|
||||||
[[languages.en.menu.shortcuts]]
|
[[languages.en.menu.shortcuts]]
|
||||||
name = '<i class="fa-fw fas fa-camera"></i> Showcases'
|
name = 'Showcases'
|
||||||
pageRef = '/showcase'
|
pageRef = '/showcase'
|
||||||
weight = 11
|
|
||||||
|
|
||||||
[[languages.en.menu.shortcuts]]
|
|
||||||
name = '<i class="fa-fw fas fa-bookmark"></i> Hugo Documentation'
|
|
||||||
identifier = 'hugodoc'
|
|
||||||
url = 'https://gohugo.io/'
|
|
||||||
weight = 20
|
weight = 20
|
||||||
|
|
||||||
[[languages.en.menu.shortcuts]]
|
[[languages.en.menu.shortcuts]]
|
||||||
name = '<i class="fa-fw fas fa-bullhorn"></i> Credits'
|
name = 'Credits'
|
||||||
pageRef = '/more/credits'
|
pageRef = '/more/credits'
|
||||||
weight = 30
|
weight = 30
|
||||||
|
|
||||||
[[languages.en.menu.shortcuts]]
|
[[languages.en.menu.shortcuts]]
|
||||||
name = '<i class="fa-fw fas fa-tags"></i> Tags'
|
pre = '<i class="fa-fw fas fa-tags"></i> '
|
||||||
|
name = 'Tags'
|
||||||
pageRef = '/tags'
|
pageRef = '/tags'
|
||||||
weight = 40
|
weight = 40
|
||||||
|
|
||||||
|
[[languages.en.menu.shortcuts]]
|
||||||
|
pre = '<i class="fa-fw fas fa-layer-group"></i> '
|
||||||
|
name = 'Categories'
|
||||||
|
pageRef = '/categories'
|
||||||
|
weight = 50
|
||||||
|
|
||||||
[languages.pir]
|
[languages.pir]
|
||||||
title = 'Captain Hugo Relearrrn Theme'
|
title = 'Captain Hugo Relearrrn Theme'
|
||||||
weight = 2
|
weight = 2
|
||||||
|
@ -116,20 +118,32 @@ For multilingual sites, set different menus for each language in `hugo.toml`:
|
||||||
weight = 11
|
weight = 11
|
||||||
|
|
||||||
[[languages.pir.menu.shortcuts]]
|
[[languages.pir.menu.shortcuts]]
|
||||||
name = '<i class="fa-fw fas fa-bookmark"></i> Captain Hugo Documentation'
|
pre = '<i class="fa-fw fab fa-github"></i> '
|
||||||
identifier = 'hugodoc'
|
name = 'GitHub Repo'
|
||||||
url = 'https://gohugo.io/'
|
url = 'https://github.com/McShelby/hugo-theme-relearn'
|
||||||
|
weight = 10
|
||||||
|
|
||||||
|
[[languages.pir.menu.shortcuts]]
|
||||||
|
name = 'Showcases'
|
||||||
|
pageRef = '/showcase'
|
||||||
weight = 20
|
weight = 20
|
||||||
|
|
||||||
[[languages.pir.menu.shortcuts]]
|
[[languages.pir.menu.shortcuts]]
|
||||||
name = '<i class="fa-fw fas fa-bullhorn"></i> Crrredits'
|
name = 'Crrredits'
|
||||||
pageRef = '/more/credits'
|
pageRef = '/more/credits'
|
||||||
weight = 30
|
weight = 30
|
||||||
|
|
||||||
[[languages.pir.menu.shortcuts]]
|
[[languages.pir.menu.shortcuts]]
|
||||||
name = '<i class="fa-fw fas fa-tags"></i> Arrr! Tags'
|
pre = '<i class="fa-fw fas fa-tags"></i> '
|
||||||
|
name = 'Arrr! Tags'
|
||||||
pageRef = '/tags'
|
pageRef = '/tags'
|
||||||
weight = 40
|
weight = 40
|
||||||
|
|
||||||
|
[[languages.pir.menu.shortcuts]]
|
||||||
|
pre = '<i class="fa-fw fas fa-layer-group"></i> '
|
||||||
|
name = 'Categorrries'
|
||||||
|
pageRef = '/categories'
|
||||||
|
weight = 50
|
||||||
{{< /multiconfig >}}
|
{{< /multiconfig >}}
|
||||||
|
|
||||||
## Displaying Pages Only in the Shortcuts Menu
|
## Displaying Pages Only in the Shortcuts Menu
|
||||||
|
|
25
exampleSite/content/introduction/releasenotes/7/1.en.md
Normal file
25
exampleSite/content/introduction/releasenotes/7/1.en.md
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
+++
|
||||||
|
disableToc = false
|
||||||
|
hidden = true
|
||||||
|
title = "Version 7.1"
|
||||||
|
type = "releasenotes"
|
||||||
|
weight = -1
|
||||||
|
+++
|
||||||
|
|
||||||
|
## 7.1.0 (xxxx-xx-xx) {#7-1-0}
|
||||||
|
|
||||||
|
### Change
|
||||||
|
|
||||||
|
- {{% badge style="note" title=" " %}}Change{{% /badge %}} The sidebar menus are now completely configurable.
|
||||||
|
|
||||||
|
This is provided by the new parameter `sidebarmenus`. With the new system, you can
|
||||||
|
|
||||||
|
- show arbitrary amounts of menus
|
||||||
|
- set headings for each menu
|
||||||
|
- base it on your page structure or use Hugo's menu feature
|
||||||
|
- configure a starting page if a menu is based on page structure
|
||||||
|
- display unlimited nesting for both menu types
|
||||||
|
- reconfigure the menus in a page's front matter
|
||||||
|
- apply the usual parameter `alwaysopen`, `collapsibleMenu`, etc. for all menu types
|
||||||
|
|
||||||
|
You don't need to change anything in your existing installation as the old configuration is used as a default.
|
|
@ -1,5 +1,8 @@
|
||||||
+++
|
+++
|
||||||
|
menuPre = "<i class='fa-fw fas fa-bullhorn'></i> "
|
||||||
title = "Credits"
|
title = "Credits"
|
||||||
|
[_build]
|
||||||
|
list = "never"
|
||||||
+++
|
+++
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
+++
|
+++
|
||||||
|
menuPre = "<i class='fa-fw fas fa-bullhorn'></i> "
|
||||||
title = "Crrredits"
|
title = "Crrredits"
|
||||||
|
[_build]
|
||||||
|
list = "never"
|
||||||
+++
|
+++
|
||||||
{{< piratify >}}
|
{{< piratify >}}
|
|
@ -1,4 +1,5 @@
|
||||||
+++
|
+++
|
||||||
|
menuPre = "<i class='fa-fw fas fa-camera'></i> "
|
||||||
title = "Showcase"
|
title = "Showcase"
|
||||||
[_build]
|
[_build]
|
||||||
render = "always"
|
render = "always"
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
+++
|
+++
|
||||||
|
menuPre = "<i class='fa-fw fas fa-camera'></i> "
|
||||||
title = "Showcase"
|
title = "Showcase"
|
||||||
[_build]
|
[_build]
|
||||||
render = "always"
|
render = "always"
|
||||||
|
|
|
@ -46,7 +46,7 @@ other = "Prrrint whole chapterrr"
|
||||||
[More-action]
|
[More-action]
|
||||||
other = "Morrre"
|
other = "Morrre"
|
||||||
|
|
||||||
[Shortcuts-Title]
|
[shortcuts-menuTitle]
|
||||||
other = "Morrre"
|
other = "Morrre"
|
||||||
|
|
||||||
[Expand-title]
|
[Expand-title]
|
||||||
|
|
|
@ -46,7 +46,7 @@ other = "طباعة الفصل بأكمله"
|
||||||
[More-action]
|
[More-action]
|
||||||
other = "المزيد"
|
other = "المزيد"
|
||||||
|
|
||||||
[Shortcuts-Title]
|
[shortcuts-menuTitle]
|
||||||
other = "المزيد"
|
other = "المزيد"
|
||||||
|
|
||||||
[Expand-title]
|
[Expand-title]
|
||||||
|
|
|
@ -46,7 +46,7 @@ other = "Vytisknout kapitolu"
|
||||||
[More-action]
|
[More-action]
|
||||||
other = "Více"
|
other = "Více"
|
||||||
|
|
||||||
[Shortcuts-Title]
|
[shortcuts-menuTitle]
|
||||||
other = "Více"
|
other = "Více"
|
||||||
|
|
||||||
[Expand-title]
|
[Expand-title]
|
||||||
|
|
|
@ -46,7 +46,7 @@ other = "Ganzes Kapitel drucken"
|
||||||
[More-action]
|
[More-action]
|
||||||
other = "Mehr"
|
other = "Mehr"
|
||||||
|
|
||||||
[Shortcuts-Title]
|
[shortcuts-menuTitle]
|
||||||
other = "Mehr"
|
other = "Mehr"
|
||||||
|
|
||||||
[Expand-title]
|
[Expand-title]
|
||||||
|
|
|
@ -46,7 +46,7 @@ other = "Print whole chapter"
|
||||||
[More-action]
|
[More-action]
|
||||||
other = "More"
|
other = "More"
|
||||||
|
|
||||||
[Shortcuts-Title]
|
[shortcuts-menuTitle]
|
||||||
other = "More"
|
other = "More"
|
||||||
|
|
||||||
[Expand-title]
|
[Expand-title]
|
||||||
|
|
|
@ -46,7 +46,7 @@ other = "Imprimir todo el capítulo"
|
||||||
[More-action]
|
[More-action]
|
||||||
other = "Más"
|
other = "Más"
|
||||||
|
|
||||||
[Shortcuts-Title]
|
[shortcuts-menuTitle]
|
||||||
other = "Más"
|
other = "Más"
|
||||||
|
|
||||||
[Expand-title]
|
[Expand-title]
|
||||||
|
|
|
@ -46,7 +46,7 @@ other = "Tulosta koko luku"
|
||||||
[More-action]
|
[More-action]
|
||||||
other = "Lisää"
|
other = "Lisää"
|
||||||
|
|
||||||
[Shortcuts-Title]
|
[shortcuts-menuTitle]
|
||||||
other = "Lisää"
|
other = "Lisää"
|
||||||
|
|
||||||
[Expand-title]
|
[Expand-title]
|
||||||
|
|
|
@ -46,7 +46,7 @@ other = "Imprimer le chapitre entier"
|
||||||
[More-action]
|
[More-action]
|
||||||
other = "Aller plus loin"
|
other = "Aller plus loin"
|
||||||
|
|
||||||
[Shortcuts-Title]
|
[shortcuts-menuTitle]
|
||||||
other = "Aller plus loin"
|
other = "Aller plus loin"
|
||||||
|
|
||||||
[Expand-title]
|
[Expand-title]
|
||||||
|
|
|
@ -46,7 +46,7 @@ other = "पूरा अध्याय मुद्रित करें"
|
||||||
[More-action]
|
[More-action]
|
||||||
other = "अधिक सामग्री दिखाएं"
|
other = "अधिक सामग्री दिखाएं"
|
||||||
|
|
||||||
[Shortcuts-Title]
|
[shortcuts-menuTitle]
|
||||||
other = "अधिक सामग्री दिखाएं"
|
other = "अधिक सामग्री दिखाएं"
|
||||||
|
|
||||||
[Expand-title]
|
[Expand-title]
|
||||||
|
|
|
@ -46,7 +46,7 @@ other = "Teljes fejezet nyomtatása"
|
||||||
[More-action]
|
[More-action]
|
||||||
other = "Egyebek"
|
other = "Egyebek"
|
||||||
|
|
||||||
[Shortcuts-Title]
|
[shortcuts-menuTitle]
|
||||||
other = "Egyebek"
|
other = "Egyebek"
|
||||||
|
|
||||||
[Expand-title]
|
[Expand-title]
|
||||||
|
|
|
@ -46,7 +46,7 @@ other = "Mencetak seluruh bab"
|
||||||
[More-action]
|
[More-action]
|
||||||
other = "Lainnya"
|
other = "Lainnya"
|
||||||
|
|
||||||
[Shortcuts-Title]
|
[shortcuts-menuTitle]
|
||||||
other = "Lainnya"
|
other = "Lainnya"
|
||||||
|
|
||||||
[Expand-title]
|
[Expand-title]
|
||||||
|
|
|
@ -46,7 +46,7 @@ other = "Stampa l'intero capitolo"
|
||||||
[More-action]
|
[More-action]
|
||||||
other = "Altro"
|
other = "Altro"
|
||||||
|
|
||||||
[Shortcuts-Title]
|
[shortcuts-menuTitle]
|
||||||
other = "Altro"
|
other = "Altro"
|
||||||
|
|
||||||
[Expand-title]
|
[Expand-title]
|
||||||
|
|
|
@ -46,7 +46,7 @@ other = "章全体を印刷する"
|
||||||
[More-action]
|
[More-action]
|
||||||
other = "更に"
|
other = "更に"
|
||||||
|
|
||||||
[Shortcuts-Title]
|
[shortcuts-menuTitle]
|
||||||
other = "更に"
|
other = "更に"
|
||||||
|
|
||||||
[Expand-title]
|
[Expand-title]
|
||||||
|
|
|
@ -46,7 +46,7 @@ other = "전체 장 인쇄"
|
||||||
[More-action]
|
[More-action]
|
||||||
other = "외부 링크"
|
other = "외부 링크"
|
||||||
|
|
||||||
[Shortcuts-Title]
|
[shortcuts-menuTitle]
|
||||||
other = "외부 링크"
|
other = "외부 링크"
|
||||||
|
|
||||||
[Expand-title]
|
[Expand-title]
|
||||||
|
|
|
@ -46,7 +46,7 @@ other = "Het hele hoofdstuk afdrukken"
|
||||||
[More-action]
|
[More-action]
|
||||||
other = "Snelkoppelingen"
|
other = "Snelkoppelingen"
|
||||||
|
|
||||||
[Shortcuts-Title]
|
[shortcuts-menuTitle]
|
||||||
other = "Snelkoppelingen"
|
other = "Snelkoppelingen"
|
||||||
|
|
||||||
[Expand-title]
|
[Expand-title]
|
||||||
|
|
|
@ -46,7 +46,7 @@ other = "Drukowanie całego rozdziału"
|
||||||
[More-action]
|
[More-action]
|
||||||
other = "Więcej"
|
other = "Więcej"
|
||||||
|
|
||||||
[Shortcuts-Title]
|
[shortcuts-menuTitle]
|
||||||
other = "Więcej"
|
other = "Więcej"
|
||||||
|
|
||||||
[Expand-title]
|
[Expand-title]
|
||||||
|
|
|
@ -46,7 +46,7 @@ other = "Imprimir capítulo inteiro"
|
||||||
[More-action]
|
[More-action]
|
||||||
other = "Mais"
|
other = "Mais"
|
||||||
|
|
||||||
[Shortcuts-Title]
|
[shortcuts-menuTitle]
|
||||||
other = "Mais"
|
other = "Mais"
|
||||||
|
|
||||||
[Expand-title]
|
[Expand-title]
|
||||||
|
|
|
@ -46,7 +46,7 @@ other = "Tipărește întregul capitol"
|
||||||
[More-action]
|
[More-action]
|
||||||
other = "Mai mult"
|
other = "Mai mult"
|
||||||
|
|
||||||
[Shortcuts-Title]
|
[shortcuts-menuTitle]
|
||||||
other = "Mai mult"
|
other = "Mai mult"
|
||||||
|
|
||||||
[Expand-title]
|
[Expand-title]
|
||||||
|
|
|
@ -46,7 +46,7 @@ other = "Печать всей главы"
|
||||||
[More-action]
|
[More-action]
|
||||||
other = "Еще"
|
other = "Еще"
|
||||||
|
|
||||||
[Shortcuts-Title]
|
[shortcuts-menuTitle]
|
||||||
other = "Еще"
|
other = "Еще"
|
||||||
|
|
||||||
[Expand-title]
|
[Expand-title]
|
||||||
|
|
|
@ -46,7 +46,7 @@ other = "Chapisha sura nzima"
|
||||||
[More-action]
|
[More-action]
|
||||||
other = "Zaidi"
|
other = "Zaidi"
|
||||||
|
|
||||||
[Shortcuts-Title]
|
[shortcuts-menuTitle]
|
||||||
other = "Zaidi"
|
other = "Zaidi"
|
||||||
|
|
||||||
[Expand-title]
|
[Expand-title]
|
||||||
|
|
|
@ -46,7 +46,7 @@ other = "Bölümün tamamını yazdır"
|
||||||
[More-action]
|
[More-action]
|
||||||
other = "Dahası Var"
|
other = "Dahası Var"
|
||||||
|
|
||||||
[Shortcuts-Title]
|
[shortcuts-menuTitle]
|
||||||
other = "Dahası Var"
|
other = "Dahası Var"
|
||||||
|
|
||||||
[Expand-title]
|
[Expand-title]
|
||||||
|
|
|
@ -46,7 +46,7 @@ other = "In toàn bộ chương"
|
||||||
[More-action]
|
[More-action]
|
||||||
other = "Nội dung khác"
|
other = "Nội dung khác"
|
||||||
|
|
||||||
[Shortcuts-Title]
|
[shortcuts-menuTitle]
|
||||||
other = "Nội dung khác"
|
other = "Nội dung khác"
|
||||||
|
|
||||||
[Expand-title]
|
[Expand-title]
|
||||||
|
|
|
@ -46,7 +46,7 @@ other = "打印整章"
|
||||||
[More-action]
|
[More-action]
|
||||||
other = "更多"
|
other = "更多"
|
||||||
|
|
||||||
[Shortcuts-Title]
|
[shortcuts-menuTitle]
|
||||||
other = "更多"
|
other = "更多"
|
||||||
|
|
||||||
[Expand-title]
|
[Expand-title]
|
||||||
|
|
|
@ -46,7 +46,7 @@ other = "打印整章"
|
||||||
[More-action]
|
[More-action]
|
||||||
other = "更多"
|
other = "更多"
|
||||||
|
|
||||||
[Shortcuts-Title]
|
[shortcuts-menuTitle]
|
||||||
other = "更多"
|
other = "更多"
|
||||||
|
|
||||||
[Expand-title]
|
[Expand-title]
|
||||||
|
|
|
@ -46,7 +46,7 @@ other = "列印整章"
|
||||||
[More-action]
|
[More-action]
|
||||||
other = "更多"
|
other = "更多"
|
||||||
|
|
||||||
[Shortcuts-Title]
|
[shortcuts-menuTitle]
|
||||||
other = "更多"
|
other = "更多"
|
||||||
|
|
||||||
[Expand-title]
|
[Expand-title]
|
||||||
|
|
|
@ -46,7 +46,7 @@ other = "列印整章"
|
||||||
[More-action]
|
[More-action]
|
||||||
other = "更多"
|
other = "更多"
|
||||||
|
|
||||||
[Shortcuts-Title]
|
[shortcuts-menuTitle]
|
||||||
other = "更多"
|
other = "更多"
|
||||||
|
|
||||||
[Expand-title]
|
[Expand-title]
|
||||||
|
|
|
@ -46,7 +46,7 @@ other = "打印整章"
|
||||||
[More-action]
|
[More-action]
|
||||||
other = "更多"
|
other = "更多"
|
||||||
|
|
||||||
[Shortcuts-Title]
|
[shortcuts-menuTitle]
|
||||||
other = "更多"
|
other = "更多"
|
||||||
|
|
||||||
[Expand-title]
|
[Expand-title]
|
||||||
|
|
|
@ -20,40 +20,20 @@
|
||||||
<hr class="padding">
|
<hr class="padding">
|
||||||
</div>
|
</div>
|
||||||
<div id="R-content-wrapper" class="highlightable">
|
<div id="R-content-wrapper" class="highlightable">
|
||||||
<div id="R-topics">
|
{{- $menuconfigs := .Params.sidebarmenus | default site.Params.sidebarmenus | default (slice
|
||||||
<ul class="enlarge morespace collapsible-menu">
|
(dict "type" "page" "identifier" "home")
|
||||||
{{- $pages := partialCached "_relearn/pages.gotmpl" (dict "page" .Site.Home) .Site.Home.Path }}
|
(dict "type" "menu" "identifier" "shortcuts")
|
||||||
{{- $defaultAlwaysopen := .Site.Params.alwaysopen | default false }}
|
) }}
|
||||||
{{- range $pages }}
|
{{- range $menuconfigs }}
|
||||||
{{- $isSubSelf := eq . $currentNode }}
|
{{- $config := . }}
|
||||||
{{- $isSubAncestor := and (not $isSubSelf) (.IsAncestor $currentNode) }}
|
{{- if eq $config.type "page" }}
|
||||||
{{- $isSubHidden := or (.Params.hidden) (eq .Title "") }}
|
{{- partial "partials/inline/page-tree" (dict "currentnode" $currentNode "config" $config "showvisitedlinks" $showvisitedlinks) }}
|
||||||
{{- if or $isSubSelf $isSubAncestor }}
|
{{- else if eq $config.type "menu" }}
|
||||||
{{- partial "partials/inline/menu-walker" (dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden ) }}
|
{{- partial "partials/inline/menu-tree" (dict "currentnode" $currentNode "config" $config "showvisitedlinks" $showvisitedlinks) }}
|
||||||
{{- else if and (not $isSubHidden) (or .Params.collapsibleMenu .Site.Params.collapsibleMenu (not .Parent.RelPermalink) (eq .Parent $currentNode) (.Parent.IsAncestor $currentNode)) }}
|
|
||||||
{{- partialCached "partials/inline/menu-walker" (dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden) .Path }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
{{- $page := . }}
|
|
||||||
{{- $disableShortcutsTitle := .Site.Params.DisableShortcutsTitle }}
|
|
||||||
{{- with .Site.Menus.shortcuts }}
|
|
||||||
<div id="R-shortcuts">
|
|
||||||
<div class="nav-title padding">{{ if not $disableShortcutsTitle }}{{ T "Shortcuts-Title" }}{{ end }}</div>
|
|
||||||
<ul class="space">
|
|
||||||
{{- range sort . "Weight" }}
|
|
||||||
{{- $shortcut := . }}
|
|
||||||
{{- with $page.Site.GetPage (printf "%s" $shortcut.URL ) }}
|
|
||||||
{{- $to := . }}
|
|
||||||
<li>{{ $shortcut.Pre }}<a class="padding" href="{{ partial "permalink.gotmpl" (dict "to" $to) }}">{{ safeHTML $shortcut.Name }}</a>{{ $shortcut.Post }}</li>
|
|
||||||
{{- else }}
|
{{- else }}
|
||||||
<li>{{ $shortcut.Pre }}<a class="padding" href="{{ $shortcut.URL | relLangURL }}">{{ safeHTML $shortcut.Name }}</a>{{ $shortcut.Post }}</li>
|
{{- warnf "WARNING: unknown menu type '%s' found in parameter 'sidebarmenus' for menu '%s'; use either 'page' or 'menu'" $config.type $config.identifier }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
{{- end }}
|
|
||||||
{{- $siteLanguages := .Site.Languages }}
|
{{- $siteLanguages := .Site.Languages }}
|
||||||
{{- $showlangswitch := and hugo.IsMultilingual (not .Site.Params.disableLanguageSwitchingButton) (gt (int (len $siteLanguages)) 1) }}
|
{{- $showlangswitch := and hugo.IsMultilingual (not .Site.Params.disableLanguageSwitchingButton) (gt (int (len $siteLanguages)) 1) }}
|
||||||
{{- $themevariants := partialCached "_relearn/themeVariants.gotmpl" . }}
|
{{- $themevariants := partialCached "_relearn/themeVariants.gotmpl" . }}
|
||||||
|
@ -119,19 +99,58 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
{{- define "partials/inline/menu-walker" }}
|
{{- define "partials/inline/page-tree" }}
|
||||||
|
{{- $currentNode := .currentnode }}
|
||||||
|
{{- $config := .config }}
|
||||||
|
{{- $showvisitedlinks := .showvisitedlinks }}
|
||||||
|
<div id="R-shortcutmenu-{{ $config.identifier }}" class="R-sidebarmenu">
|
||||||
|
{{- with site.Home.GetPage ($config.pageRef | default "") }}
|
||||||
|
{{- $entry := . }}
|
||||||
|
{{- $entries := partialCached "_relearn/pages.gotmpl" (dict "page" $entry) $entry.Path }}
|
||||||
|
{{- $title := "" }}
|
||||||
|
{{- if not ($config.disableTitle | default true) }}
|
||||||
|
{{ $title = $entry.Params.menuTitle | default (T (print $config.identifier "-menuTitle")) }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with $title }}
|
||||||
|
<div class="nav-title padding">{{ . }}</div>
|
||||||
|
{{- end }}
|
||||||
|
{{- $classes := "space " }}
|
||||||
|
{{- if ($config.main | default true) }}
|
||||||
|
{{- $classes = "enlarge morespace " }}
|
||||||
|
{{- end }}
|
||||||
|
<ul class="{{ $classes }}collapsible-menu">
|
||||||
|
{{- $defaultAlwaysopen := site.Params.alwaysopen | default false }}
|
||||||
|
{{- range $entries }}
|
||||||
|
{{- $isSubSelf := eq . $currentNode }}
|
||||||
|
{{- $isSubAncestor := and (not $isSubSelf) (.IsAncestor $currentNode) }}
|
||||||
|
{{- $isSubHidden := or (.Params.hidden) (eq .Title "") }}
|
||||||
|
{{- $isSubCollapsible := .Params.collapsibleMenu | default site.Params.collapsibleMenu }}
|
||||||
|
{{- if or $isSubSelf $isSubAncestor }}
|
||||||
|
{{- partial "partials/inline/page-walker" (dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden) }}
|
||||||
|
{{- else if and (not $isSubHidden) (or $isSubCollapsible (not $entry.RelPermalink) (eq $entry $currentNode) ($entry.IsAncestor $currentNode)) }}
|
||||||
|
{{- $id := md5 .Path }}
|
||||||
|
{{- partialCached "partials/inline/page-walker" (dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden) $id }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{{- else }}
|
||||||
|
{{- warnf "WARNING: page '%s' not found for sidebar menu '%s'" ($config.pageRef | default "") $config.identifier }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- define "partials/inline/page-walker" }}
|
||||||
{{- $currentNode := .currentnode }}
|
{{- $currentNode := .currentnode }}
|
||||||
{{- $showvisitedlinks := .showvisitedlinks }}
|
{{- $showvisitedlinks := .showvisitedlinks }}
|
||||||
{{- $alwaysopen := .alwaysopen }}
|
{{- $alwaysopen := .alwaysopen }}
|
||||||
{{- $currentFileRelPermalink := .currentnode.RelPermalink }}
|
|
||||||
{{- $isSelf := .isSelf }}
|
{{- $isSelf := .isSelf }}
|
||||||
{{- $isAncestor := .isAncestor }}
|
{{- $isAncestor := .isAncestor }}
|
||||||
{{- $isHidden := .isHidden }}
|
{{- $isHidden := .isHidden }}
|
||||||
{{- with .sect }}
|
{{- with .sect }}
|
||||||
{{- $isActive := $isSelf }}
|
{{- $isActive := $isSelf }}
|
||||||
{{- $pages := partialCached "_relearn/pages.gotmpl" (dict "page" .) .Path }}
|
{{- $entry := . }}
|
||||||
|
{{- $entries := partialCached "_relearn/pages.gotmpl" (dict "page" .) .Path }}
|
||||||
{{- $hasVisibleChildren := false }}
|
{{- $hasVisibleChildren := false }}
|
||||||
{{- range $pages }}
|
{{- range $entries }}
|
||||||
{{- $isSubSelf := eq . $currentNode }}
|
{{- $isSubSelf := eq . $currentNode }}
|
||||||
{{- $isSubAncestor := and (not $isSubSelf) (.IsAncestor $currentNode) }}
|
{{- $isSubAncestor := and (not $isSubSelf) (.IsAncestor $currentNode) }}
|
||||||
{{- $isSubHidden := or (.Params.hidden) (eq .Title "") }}
|
{{- $isSubHidden := or (.Params.hidden) (eq .Title "") }}
|
||||||
|
@ -142,31 +161,164 @@
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $title := partial "title.gotmpl" (dict "page" . "linkTitle" true) }}
|
{{- $title := partial "title.gotmpl" (dict "page" . "linkTitle" true) }}
|
||||||
{{- $url := partial "permalink.gotmpl" (dict "to" .) }}
|
{{- $url := partial "permalink.gotmpl" (dict "to" .) }}
|
||||||
|
{{- $pre := partial "menu-pre.html" . }}
|
||||||
|
{{- $post := partial "menu-post.html" . }}
|
||||||
{{- if $hasVisibleChildren }}
|
{{- if $hasVisibleChildren }}
|
||||||
{{- $isCollapsible := or .Params.collapsibleMenu .Site.Params.collapsibleMenu }}
|
{{- $isCollapsible := .Params.collapsibleMenu | default site.Params.collapsibleMenu }}
|
||||||
{{- $currentAlwaysopen := .Params.alwaysopen | default $alwaysopen }}
|
{{- $currentAlwaysopen := .Params.alwaysopen | default $alwaysopen }}
|
||||||
{{- $pageId := md5 .Page }}
|
{{- if and (not $url) (not $isCollapsible) }}
|
||||||
|
{{- $currentAlwaysopen = true }}
|
||||||
|
{{- end }}
|
||||||
|
{{- $entryId := md5 .Path }}
|
||||||
{{- $isOpen := or $currentAlwaysopen $isSelf $isAncestor }}
|
{{- $isOpen := or $currentAlwaysopen $isSelf $isAncestor }}
|
||||||
<li class="{{if $isActive }}active {{end}}{{if (or $isSelf $isAncestor) }}parent {{end}}{{if $isHidden }}hidden {{end}}{{if not $url }}headless {{end}}{{if $currentAlwaysopen}}alwaysopen {{end}}" data-nav-id="{{ $url }}">
|
<li class="{{if $isActive }}active {{end}}{{if (or $isSelf $isAncestor) }}parent {{end}}{{if $isHidden }}hidden {{end}}{{if not $url }}headless {{end}}{{if $currentAlwaysopen}}alwaysopen {{end}}" data-nav-id="{{ $url }}">
|
||||||
{{- if $isCollapsible }}<input type="checkbox" id="R-section-{{ $pageId }}" aria-controls="R-subsections-{{ $pageId }}"{{ if $isOpen }} checked{{ end }}><label for="R-section-{{ $pageId }}"><i class="fa-fw fas fa-chevron-down"></i><i class="fa-fw fas fa-chevron-right"></i><span class="a11y-only">{{ T "Submenu" $title }}</span></label>{{ end }}
|
{{- if $isCollapsible }}<input type="checkbox" id="R-section-{{ $entryId }}" aria-controls="R-subsections-{{ $entryId }}"{{ if $isOpen }} checked{{ end }}><label for="R-section-{{ $entryId }}"><i class="fa-fw fas fa-chevron-down"></i><i class="fa-fw fas fa-chevron-right"></i><span class="a11y-only">{{ T "Submenu" $title }}</span></label>{{ end }}
|
||||||
{{- if $url }}<a class="padding" href="{{ $url }}">{{ else }}<span class="padding">{{ end }}
|
{{- if $url }}<a class="padding" href="{{ $url }}">{{ else }}<span class="padding">{{ end }}
|
||||||
{{- partial "menu-pre.html" . }}{{ $title }}{{ partial "menu-post.html" . }}
|
{{- $pre }}{{ $title }}{{ $post }}
|
||||||
{{- if $url }}{{ if $showvisitedlinks }}<i class="fa-fw fas fa-check read-icon"></i>{{ end }}</a>{{ else }}</span>{{ end }}<ul id="R-subsections-{{ $pageId }}" class="collapsible-menu">
|
{{- if $url }}{{ if $showvisitedlinks }}<i class="fa-fw fas fa-check read-icon"></i>{{ end }}</a>{{ else }}</span>{{ end }}<ul id="R-subsections-{{ $entryId }}" class="collapsible-menu">
|
||||||
{{- $defaultAlwaysopen := .Site.Params.alwaysopen | default true }}
|
{{- $defaultAlwaysopen := site.Params.alwaysopen | default true }}
|
||||||
{{- range $pages }}
|
{{- range $entries }}
|
||||||
{{- $isSubSelf := eq . $currentNode }}
|
{{- $isSubSelf := eq . $currentNode }}
|
||||||
{{- $isSubAncestor := and (not $isSubSelf) (.IsAncestor $currentNode) }}
|
{{- $isSubAncestor := and (not $isSubSelf) (.IsAncestor $currentNode) }}
|
||||||
{{- $isSubHidden := or (.Params.hidden) (eq .Title "") }}
|
{{- $isSubHidden := or (.Params.hidden) (eq .Title "") }}
|
||||||
|
{{- $isSubCollapsible := .Params.collapsibleMenu | default site.Params.collapsibleMenu }}
|
||||||
{{- if or $isSubSelf $isSubAncestor }}
|
{{- if or $isSubSelf $isSubAncestor }}
|
||||||
{{- partial "partials/inline/menu-walker" (dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden) }}
|
{{- partial "partials/inline/page-walker" (dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden) }}
|
||||||
{{- else if and (not $isSubHidden) (or .Params.collapsibleMenu .Site.Params.collapsibleMenu (not .Parent.RelPermalink) (eq .Parent $currentNode) (.Parent.IsAncestor $currentNode)) }}
|
{{- else if and (not $isSubHidden) (or $isSubCollapsible (not $entry.RelPermalink) (eq $entry $currentNode) ($entry.IsAncestor $currentNode)) }}
|
||||||
{{- partialCached "partials/inline/menu-walker" (dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden) .Path }}
|
{{- $id := md5 .Path }}
|
||||||
|
{{- partialCached "partials/inline/page-walker" (dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden) $id }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}</ul></li>
|
{{- end }}</ul></li>
|
||||||
{{- else }}
|
{{- else if $url }}
|
||||||
<li class="{{if $isActive }}active {{end}}{{if $isHidden }}hidden {{end}}{{if not $url }}headless {{end}}" data-nav-id="{{ $url }}">
|
<li class="{{if $isActive }}active {{end}}{{if $isHidden }}hidden {{end}}{{if not $url }}headless {{end}}" data-nav-id="{{ $url }}">
|
||||||
{{- if $url }}<a class="padding" href="{{ $url }}">{{ else }}<span class="padding">{{ end }}
|
{{- if $url }}<a class="padding" href="{{ $url }}">{{ else }}<span class="padding">{{ end }}
|
||||||
{{- partial "menu-pre.html" . }}{{ $title }}{{ partial "menu-post.html" . }}
|
{{- $pre }}{{ $title }}{{ $post }}
|
||||||
|
{{- if $url }}{{ if $showvisitedlinks }}<i class="fa-fw fas fa-check read-icon"></i>{{ end }}</a>{{ else }}</span>{{ end }}</li>
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- define "partials/inline/menu-tree" }}
|
||||||
|
{{- $currentNode := .currentnode }}
|
||||||
|
{{- $config := .config }}
|
||||||
|
{{- $showvisitedlinks := .showvisitedlinks }}
|
||||||
|
{{- with index site.Menus $config.identifier }}
|
||||||
|
<div id="R-shortcutmenu-{{ $config.identifier }}" class="R-sidebarmenu">
|
||||||
|
{{- $entry := "" }}
|
||||||
|
{{- $entries := . }}
|
||||||
|
{{- if eq (len $entries) 1 }}
|
||||||
|
{{- with index $entries 0 }}
|
||||||
|
{{- if not (partial "menupermalink.gotmpl" .) }}
|
||||||
|
{{- /* because in Hugo menus can not have parameter but menu entries can,
|
||||||
|
we can flag a single top level menu entry as a container; this container
|
||||||
|
entry carrys just meta information and parameter, uses its children
|
||||||
|
to build the "real" menu, and has no own `url` or `pageRef` */}}
|
||||||
|
{{- $entry = . }}
|
||||||
|
{{- $entries = .Children }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- $title := "" }}
|
||||||
|
{{- if not ($config.disableTitle | default false) }}
|
||||||
|
{{- if $entry }}
|
||||||
|
{{- $title = partial "menutitle.gotmpl" $entry }}
|
||||||
|
{{- else if eq $config.identifier "shortcuts" }}
|
||||||
|
{{- if not site.Params.DisableShortcutsTitle }}
|
||||||
|
{{- $title = T (print $config.identifier "-menuTitle") }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else }}
|
||||||
|
{{- $title = T (print $config.identifier "-menuTitle") }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with $title }}
|
||||||
|
<div class="nav-title padding">{{ . }}</div>
|
||||||
|
{{- end }}
|
||||||
|
{{- $classes := "space " }}
|
||||||
|
{{- if ($config.main | default false) }}
|
||||||
|
{{- $classes = "enlarge morespace " }}
|
||||||
|
{{- end }}
|
||||||
|
<ul class="{{ $classes }}collapsible-menu">
|
||||||
|
{{- $root := or $entry site }}
|
||||||
|
{{- $defaultAlwaysopen := site.Params.alwaysopen | default false }}
|
||||||
|
{{- range $entries }}
|
||||||
|
{{- $isSubSelf := eq .Page $currentNode }}
|
||||||
|
{{- $isSubAncestor := and (not $isSubSelf) ($currentNode.HasMenuCurrent .Menu .) }}
|
||||||
|
{{- $isSubHidden := or (.Params.hidden) (eq (partial "menutitle.gotmpl" .) "") }}
|
||||||
|
{{- $isSubCollapsible := .Params.collapsibleMenu | default $root.Params.collapsibleMenu | default site.Params.collapsibleMenu }}
|
||||||
|
{{- if or $isSubSelf $isSubAncestor }}
|
||||||
|
{{- partial "partials/inline/menu-walker" (dict "menu" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden "root" $root) }}
|
||||||
|
{{- else if and (not $isSubHidden) (or $isSubCollapsible (not (partial "menupermalink.gotmpl" $entry)) (and $entry (eq $entry.Page $currentNode)) (and $entry ($currentNode.HasMenuCurrent $entry.Menu $entry))) }}
|
||||||
|
{{- $id := md5 (print .) }}
|
||||||
|
{{- partialCached "partials/inline/menu-walker" (dict "menu" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden "root" $root) $id }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{{- else }}
|
||||||
|
{{ if ne $config.identifier "shortcuts" }}
|
||||||
|
{{- warnf "WARNING: menu '%s' not found for sidebar menu '%s'" $config.identifier $config.identifier }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- define "partials/inline/menu-walker" }}
|
||||||
|
{{- $currentNode := .currentnode }}
|
||||||
|
{{- $showvisitedlinks := .showvisitedlinks }}
|
||||||
|
{{- $alwaysopen := .alwaysopen }}
|
||||||
|
{{- $isSelf := .isSelf }}
|
||||||
|
{{- $isAncestor := .isAncestor }}
|
||||||
|
{{- $isHidden := .isHidden }}
|
||||||
|
{{- $root := .root }}
|
||||||
|
{{- with .menu }}
|
||||||
|
{{- $isActive := $isSelf }}
|
||||||
|
{{- $entry := . }}
|
||||||
|
{{- $entries := .Children }}
|
||||||
|
{{- $hasVisibleChildren := false }}
|
||||||
|
{{- range $entries }}
|
||||||
|
{{- $isSubSelf := eq .Page $currentNode }}
|
||||||
|
{{- $isSubAncestor := and (not $isSubSelf) ($currentNode.HasMenuCurrent .Menu .) }}
|
||||||
|
{{- $isSubHidden := or (.Params.hidden) (eq (partial "menutitle.gotmpl" .) "") }}
|
||||||
|
{{- if or $isSubAncestor $isSubSelf (not $isSubHidden) }}
|
||||||
|
{{- $hasVisibleChildren = true }}
|
||||||
|
{{- break }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- $title := partial "menutitle.gotmpl" . }}
|
||||||
|
{{- $url := partial "menupermalink.gotmpl" . }}
|
||||||
|
{{- $pre := .Pre }}
|
||||||
|
{{- $post := .Post }}
|
||||||
|
{{- with .Page }}
|
||||||
|
{{- $pre = or $pre (partial "menu-pre.html" .) }}
|
||||||
|
{{- $post = or $post (partial "menu-post.html" .) }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if $hasVisibleChildren }}
|
||||||
|
{{- $isCollapsible := .Params.collapsibleMenu | default $root.Params.collapsibleMenu | default site.Params.collapsibleMenu }}
|
||||||
|
{{- $currentAlwaysopen := .Params.alwaysopen | default $root.Params.alwaysopen | default $alwaysopen }}
|
||||||
|
{{- if and (not $url) (not $isCollapsible) }}
|
||||||
|
{{- $currentAlwaysopen = true }}
|
||||||
|
{{- end }}
|
||||||
|
{{- $entryId := md5 (print .) }}
|
||||||
|
{{- $isOpen := or $currentAlwaysopen $isSelf $isAncestor }}
|
||||||
|
<li class="{{if $isActive }}active {{end}}{{if (or $isSelf $isAncestor) }}parent {{end}}{{if $isHidden }}hidden {{end}}{{if not $url }}headless {{end}}{{if $currentAlwaysopen}}alwaysopen {{end}}" data-nav-id="{{ $url }}">
|
||||||
|
{{- if $isCollapsible }}<input type="checkbox" id="R-section-{{ $entryId }}" aria-controls="R-subsections-{{ $entryId }}"{{ if $isOpen }} checked{{ end }}><label for="R-section-{{ $entryId }}"><i class="fa-fw fas fa-chevron-down"></i><i class="fa-fw fas fa-chevron-right"></i><span class="a11y-only">{{ T "Submenu" $title }}</span></label>{{ end }}
|
||||||
|
{{- if $url }}<a class="padding" href="{{ $url }}">{{ else }}<span class="padding">{{ end }}
|
||||||
|
{{- $pre }}{{ $title }}{{ $post }}
|
||||||
|
{{- if $url }}{{ if $showvisitedlinks }}<i class="fa-fw fas fa-check read-icon"></i>{{ end }}</a>{{ else }}</span>{{ end }}<ul id="R-subsections-{{ $entryId }}" class="collapsible-menu">
|
||||||
|
{{- $defaultAlwaysopen := site.Params.alwaysopen | default true }}
|
||||||
|
{{- range $entries }}
|
||||||
|
{{- $isSubSelf := eq .Page $currentNode }}
|
||||||
|
{{- $isSubAncestor := and (not $isSubSelf) ($currentNode.HasMenuCurrent .Menu .) }}
|
||||||
|
{{- $isSubHidden := or (.Params.hidden) (eq (partial "menutitle.gotmpl" .) "") }}
|
||||||
|
{{- $isSubCollapsible := .Params.collapsibleMenu | default $root.Params.collapsibleMenu | default site.Params.collapsibleMenu }}
|
||||||
|
{{- if or $isSubSelf $isSubAncestor }}
|
||||||
|
{{- partial "partials/inline/menu-walker" (dict "menu" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden "root" $root) }}
|
||||||
|
{{- else if and (not $isSubHidden) (or $isSubCollapsible (not (partial "menupermalink.gotmpl" $entry)) (eq $entry.Page $currentNode) ($currentNode.HasMenuCurrent $entry.Menu $entry)) }}
|
||||||
|
{{- $id := md5 (print .) }}
|
||||||
|
{{- partialCached "partials/inline/menu-walker" (dict "menu" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden "root" $root) $id }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}</ul></li>
|
||||||
|
{{- else if $url }}
|
||||||
|
<li class="{{if $isActive }}active {{end}}{{if $isHidden }}hidden {{end}}{{if not $url }}headless {{end}}" data-nav-id="{{ $url }}">
|
||||||
|
{{- if $url }}<a class="padding" href="{{ $url }}">{{ else }}<span class="padding">{{ end }}
|
||||||
|
{{- $pre }}{{ $title }}{{ $post }}
|
||||||
{{- if $url }}{{ if $showvisitedlinks }}<i class="fa-fw fas fa-check read-icon"></i>{{ end }}</a>{{ else }}</span>{{ end }}</li>
|
{{- if $url }}{{ if $showvisitedlinks }}<i class="fa-fw fas fa-check read-icon"></i>{{ end }}</a>{{ else }}</span>{{ end }}</li>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
10
layouts/partials/menupermalink.gotmpl
Normal file
10
layouts/partials/menupermalink.gotmpl
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{{- $url := "" }}
|
||||||
|
{{- with . }}
|
||||||
|
{{- with .URL }}
|
||||||
|
{{- $url = . | relLangURL }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Page }}
|
||||||
|
{{- $url = partial "permalink.gotmpl" (dict "to" .) }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- return $url }}
|
12
layouts/partials/menutitle.gotmpl
Normal file
12
layouts/partials/menutitle.gotmpl
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{{- $title := "" }}
|
||||||
|
{{- with . }}
|
||||||
|
{{- $pagetitle := "" }}
|
||||||
|
{{- with .Page }}
|
||||||
|
{{- $pagetitle = or .LinkTitle .Title }}
|
||||||
|
{{- end }}
|
||||||
|
{{- $title = or .Title (.Name | safeHTML) }}
|
||||||
|
{{- if and (eq $pagetitle .Title) (ne .Name .Title) }}
|
||||||
|
{{- $title = (.Name | safeHTML) }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- return $title }}
|
|
@ -1,8 +1,5 @@
|
||||||
{{- $title := "" }}
|
{{- $title := "" }}
|
||||||
{{- with .page }}
|
{{- with .page }}
|
||||||
{{- if .Params.menuTitle }}
|
|
||||||
{{- warnf "%q: UNSUPPORTED front matter 'menutitle' found, use 'linktitle' instead; see https://mcshelby.github.io/hugo-theme-relearn/introduction/releasenotes/6/#6-0-0" $.File.Filename }}
|
|
||||||
{{- end }}
|
|
||||||
{{- $siteTitle := site.Title }}
|
{{- $siteTitle := site.Title }}
|
||||||
{{- if $.linkTitle }}
|
{{- if $.linkTitle }}
|
||||||
{{- $siteTitle := or site.Params.linkTitle site.Title }}
|
{{- $siteTitle := or site.Params.linkTitle site.Title }}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
7.0.1+72a875f1db967152c77914cff4d53f8fcee0e619
|
7.0.1+06e70da8a6fb2043fe7e56b818ff638a309c8239
|
|
@ -16,7 +16,7 @@ features = [
|
||||||
'hidden pages',
|
'hidden pages',
|
||||||
'i18n', 'icons', 'image resizing', 'include',
|
'i18n', 'icons', 'image resizing', 'include',
|
||||||
'light', 'lightbox', 'logo',
|
'light', 'lightbox', 'logo',
|
||||||
'math', 'mathjax', 'menu', 'mermaid', 'multilingual', 'mobile',
|
'math', 'mathjax', 'menus', 'mermaid', 'multilingual', 'mobile',
|
||||||
'nested menus', 'nested sections', 'notice',
|
'nested menus', 'nested sections', 'notice',
|
||||||
'oas', 'offline usable', 'openapi', 'open graph',
|
'oas', 'offline usable', 'openapi', 'open graph',
|
||||||
'print', 'printable',
|
'print', 'printable',
|
||||||
|
|
Loading…
Reference in a new issue