mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-22 15:27:54 +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)
|
||||
- [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)
|
||||
- [Nested navigation menu](https://mcshelby.github.io/hugo-theme-relearn/authoring/frontmatter/navigationmenu)
|
||||
- [Configurable menu shortcuts](https://mcshelby.github.io/hugo-theme-relearn/configuration/sidebar/shortcutmenu)
|
||||
- [Nested menus](https://mcshelby.github.io/hugo-theme-relearn/authoring/frontmatter/navigationmenu)
|
||||
- [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)
|
||||
- [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)
|
||||
|
|
|
@ -310,6 +310,14 @@ a:focus,
|
|||
margin-right: 0;
|
||||
}
|
||||
|
||||
#R-sidebar .R-sidebarmenu > ul {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
#R-sidebar .R-sidebarmenu > .nav-title ~ ul {
|
||||
margin-top: .8rem;
|
||||
}
|
||||
|
||||
#R-sidebar ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
|
@ -2685,10 +2693,6 @@ body #R-logo svg * {
|
|||
padding-bottom: 1rem;
|
||||
}
|
||||
|
||||
#R-topics {
|
||||
padding-top: 1rem;
|
||||
}
|
||||
|
||||
article .R-taxonomy ul,
|
||||
article .R-taxonomy li {
|
||||
list-style: none;
|
||||
|
|
|
@ -106,28 +106,30 @@ summaryLength = 10
|
|||
landingPageName = '<i class="fa-fw fas fa-home"></i> Home'
|
||||
|
||||
[[languages.en.menu.shortcuts]]
|
||||
name = '<i class="fa-fw fab fa-github"></i> GitHub Repo'
|
||||
identifier = 'ds'
|
||||
pre = '<i class="fa-fw fab fa-github"></i> '
|
||||
name = 'GitHub Repo'
|
||||
url = 'https://github.com/McShelby/hugo-theme-relearn'
|
||||
weight = 10
|
||||
|
||||
[[languages.en.menu.shortcuts]]
|
||||
name = '<i class="fa-fw fas fa-camera"></i> Showcases'
|
||||
name = 'Showcases'
|
||||
pageRef = '/showcase'
|
||||
weight = 20
|
||||
|
||||
[[languages.en.menu.shortcuts]]
|
||||
name = '<i class="fa-fw fas fa-bullhorn"></i> Credits'
|
||||
name = 'Credits'
|
||||
pageRef = '/more/credits'
|
||||
weight = 30
|
||||
|
||||
[[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'
|
||||
weight = 40
|
||||
|
||||
[[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'
|
||||
weight = 50
|
||||
|
||||
|
@ -152,28 +154,30 @@ summaryLength = 10
|
|||
landingPageName = '<i class="fa-fw fas home"></i> Arrr! Home'
|
||||
|
||||
[[languages.pir.menu.shortcuts]]
|
||||
name = '<i class="fa-fw fab fa-github"></i> GitHub Repo'
|
||||
identifier = 'ds'
|
||||
pre = '<i class="fa-fw fab fa-github"></i> '
|
||||
name = 'GitHub Repo'
|
||||
url = 'https://github.com/McShelby/hugo-theme-relearn'
|
||||
weight = 10
|
||||
|
||||
[[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'
|
||||
weight = 20
|
||||
|
||||
[[languages.pir.menu.shortcuts]]
|
||||
name = '<i class="fa-fw fas fa-bullhorn"></i> Crrredits'
|
||||
name = 'Crrredits'
|
||||
pageRef = '/more/credits'
|
||||
weight = 30
|
||||
|
||||
[[languages.pir.menu.shortcuts]]
|
||||
name = '<i class="fa-fw fas fa-tags"></i> Arrr! Tags'
|
||||
name = 'Arrr! Tags'
|
||||
pageRef = '/tags'
|
||||
weight = 40
|
||||
|
||||
[[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'
|
||||
weight = 50
|
||||
|
||||
|
|
|
@ -196,6 +196,13 @@ additionalContentLanguage = [ 'en' ]
|
|||
# Menu
|
||||
# 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.
|
||||
# Default: false
|
||||
# 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.
|
||||
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.
|
||||
# Default: false
|
||||
# If you have more than one language configured, a language switcher is
|
||||
|
@ -245,6 +239,45 @@ disableShortcutsTitle = false
|
|||
# turn this behavior off.
|
||||
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
|
||||
# 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
|
||||
|
||||
{{< multiconfig fm=true >}}
|
||||
collapsibleMenu = true
|
||||
[_build]
|
||||
render = 'never'
|
||||
{{< /multiconfig >}}
|
||||
|
|
|
@ -115,6 +115,36 @@ alwaysopen = ''
|
|||
# If not set, the set value of your site's hugo.toml is used.
|
||||
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
|
||||
# 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.
|
||||
|
||||
````toml {title="i18n/en.toml"}
|
||||
[Shortcuts-Title]
|
||||
[shortcuts-menuTitle]
|
||||
other = "Other Great Stuff"
|
||||
````
|
||||
|
||||
|
@ -34,31 +34,32 @@ Edit `hugo.toml` and add `[[menu.shortcuts]]` entries for each link:
|
|||
|
||||
{{< multiconfig file=hugo >}}
|
||||
[[menu.shortcuts]]
|
||||
name = '<i class="fa-fw fab fa-github"></i> GitHub Repo'
|
||||
identifier = 'ds'
|
||||
pre = '<i class="fa-fw fab fa-github"></i> '
|
||||
name = 'GitHub Repo'
|
||||
url = 'https://github.com/McShelby/hugo-theme-relearn'
|
||||
weight = 10
|
||||
|
||||
[[menu.shortcuts]]
|
||||
name = '<i class="fa-fw fas fa-camera"></i> Showcases'
|
||||
name = 'Showcases'
|
||||
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
|
||||
|
||||
[[menu.shortcuts]]
|
||||
name = '<i class="fa-fw fas fa-bullhorn"></i> Credits'
|
||||
name = 'Credits'
|
||||
pageRef = '/more/credits'
|
||||
weight = 30
|
||||
|
||||
[[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'
|
||||
weight = 40
|
||||
|
||||
[[menu.shortcuts]]
|
||||
pre = '<i class="fa-fw fas fa-layer-group"></i> '
|
||||
name = 'Categories'
|
||||
pageRef = '/categories'
|
||||
weight = 50
|
||||
{{< /multiconfig >}}
|
||||
|
||||
## Multilingual Example
|
||||
|
@ -73,32 +74,33 @@ For multilingual sites, set different menus for each language in `hugo.toml`:
|
|||
languageName = 'English'
|
||||
|
||||
[[languages.en.menu.shortcuts]]
|
||||
name = '<i class="fa-fw fab fa-github"></i> GitHub Repo'
|
||||
identifier = 'ds'
|
||||
pre = '<i class="fa-fw fab fa-github"></i> '
|
||||
name = 'GitHub Repo'
|
||||
url = 'https://github.com/McShelby/hugo-theme-relearn'
|
||||
weight = 10
|
||||
|
||||
[[languages.en.menu.shortcuts]]
|
||||
name = '<i class="fa-fw fas fa-camera"></i> Showcases'
|
||||
name = 'Showcases'
|
||||
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
|
||||
|
||||
[[languages.en.menu.shortcuts]]
|
||||
name = '<i class="fa-fw fas fa-bullhorn"></i> Credits'
|
||||
name = 'Credits'
|
||||
pageRef = '/more/credits'
|
||||
weight = 30
|
||||
|
||||
[[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'
|
||||
weight = 40
|
||||
|
||||
[[languages.en.menu.shortcuts]]
|
||||
pre = '<i class="fa-fw fas fa-layer-group"></i> '
|
||||
name = 'Categories'
|
||||
pageRef = '/categories'
|
||||
weight = 50
|
||||
|
||||
[languages.pir]
|
||||
title = 'Captain Hugo Relearrrn Theme'
|
||||
weight = 2
|
||||
|
@ -116,20 +118,32 @@ For multilingual sites, set different menus for each language in `hugo.toml`:
|
|||
weight = 11
|
||||
|
||||
[[languages.pir.menu.shortcuts]]
|
||||
name = '<i class="fa-fw fas fa-bookmark"></i> Captain Hugo Documentation'
|
||||
identifier = 'hugodoc'
|
||||
url = 'https://gohugo.io/'
|
||||
pre = '<i class="fa-fw fab fa-github"></i> '
|
||||
name = 'GitHub Repo'
|
||||
url = 'https://github.com/McShelby/hugo-theme-relearn'
|
||||
weight = 10
|
||||
|
||||
[[languages.pir.menu.shortcuts]]
|
||||
name = 'Showcases'
|
||||
pageRef = '/showcase'
|
||||
weight = 20
|
||||
|
||||
[[languages.pir.menu.shortcuts]]
|
||||
name = '<i class="fa-fw fas fa-bullhorn"></i> Crrredits'
|
||||
name = 'Crrredits'
|
||||
pageRef = '/more/credits'
|
||||
weight = 30
|
||||
|
||||
[[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'
|
||||
weight = 40
|
||||
|
||||
[[languages.pir.menu.shortcuts]]
|
||||
pre = '<i class="fa-fw fas fa-layer-group"></i> '
|
||||
name = 'Categorrries'
|
||||
pageRef = '/categories'
|
||||
weight = 50
|
||||
{{< /multiconfig >}}
|
||||
|
||||
## 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"
|
||||
[_build]
|
||||
list = "never"
|
||||
+++
|
||||
|
||||
## Contributors
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
+++
|
||||
menuPre = "<i class='fa-fw fas fa-bullhorn'></i> "
|
||||
title = "Crrredits"
|
||||
[_build]
|
||||
list = "never"
|
||||
+++
|
||||
{{< piratify >}}
|
|
@ -1,4 +1,5 @@
|
|||
+++
|
||||
menuPre = "<i class='fa-fw fas fa-camera'></i> "
|
||||
title = "Showcase"
|
||||
[_build]
|
||||
render = "always"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
+++
|
||||
menuPre = "<i class='fa-fw fas fa-camera'></i> "
|
||||
title = "Showcase"
|
||||
[_build]
|
||||
render = "always"
|
||||
|
|
|
@ -46,7 +46,7 @@ other = "Prrrint whole chapterrr"
|
|||
[More-action]
|
||||
other = "Morrre"
|
||||
|
||||
[Shortcuts-Title]
|
||||
[shortcuts-menuTitle]
|
||||
other = "Morrre"
|
||||
|
||||
[Expand-title]
|
||||
|
|
|
@ -46,7 +46,7 @@ other = "طباعة الفصل بأكمله"
|
|||
[More-action]
|
||||
other = "المزيد"
|
||||
|
||||
[Shortcuts-Title]
|
||||
[shortcuts-menuTitle]
|
||||
other = "المزيد"
|
||||
|
||||
[Expand-title]
|
||||
|
|
|
@ -46,7 +46,7 @@ other = "Vytisknout kapitolu"
|
|||
[More-action]
|
||||
other = "Více"
|
||||
|
||||
[Shortcuts-Title]
|
||||
[shortcuts-menuTitle]
|
||||
other = "Více"
|
||||
|
||||
[Expand-title]
|
||||
|
|
|
@ -46,7 +46,7 @@ other = "Ganzes Kapitel drucken"
|
|||
[More-action]
|
||||
other = "Mehr"
|
||||
|
||||
[Shortcuts-Title]
|
||||
[shortcuts-menuTitle]
|
||||
other = "Mehr"
|
||||
|
||||
[Expand-title]
|
||||
|
|
|
@ -46,7 +46,7 @@ other = "Print whole chapter"
|
|||
[More-action]
|
||||
other = "More"
|
||||
|
||||
[Shortcuts-Title]
|
||||
[shortcuts-menuTitle]
|
||||
other = "More"
|
||||
|
||||
[Expand-title]
|
||||
|
|
|
@ -46,7 +46,7 @@ other = "Imprimir todo el capítulo"
|
|||
[More-action]
|
||||
other = "Más"
|
||||
|
||||
[Shortcuts-Title]
|
||||
[shortcuts-menuTitle]
|
||||
other = "Más"
|
||||
|
||||
[Expand-title]
|
||||
|
|
|
@ -46,7 +46,7 @@ other = "Tulosta koko luku"
|
|||
[More-action]
|
||||
other = "Lisää"
|
||||
|
||||
[Shortcuts-Title]
|
||||
[shortcuts-menuTitle]
|
||||
other = "Lisää"
|
||||
|
||||
[Expand-title]
|
||||
|
|
|
@ -46,7 +46,7 @@ other = "Imprimer le chapitre entier"
|
|||
[More-action]
|
||||
other = "Aller plus loin"
|
||||
|
||||
[Shortcuts-Title]
|
||||
[shortcuts-menuTitle]
|
||||
other = "Aller plus loin"
|
||||
|
||||
[Expand-title]
|
||||
|
|
|
@ -46,7 +46,7 @@ other = "पूरा अध्याय मुद्रित करें"
|
|||
[More-action]
|
||||
other = "अधिक सामग्री दिखाएं"
|
||||
|
||||
[Shortcuts-Title]
|
||||
[shortcuts-menuTitle]
|
||||
other = "अधिक सामग्री दिखाएं"
|
||||
|
||||
[Expand-title]
|
||||
|
|
|
@ -46,7 +46,7 @@ other = "Teljes fejezet nyomtatása"
|
|||
[More-action]
|
||||
other = "Egyebek"
|
||||
|
||||
[Shortcuts-Title]
|
||||
[shortcuts-menuTitle]
|
||||
other = "Egyebek"
|
||||
|
||||
[Expand-title]
|
||||
|
|
|
@ -46,7 +46,7 @@ other = "Mencetak seluruh bab"
|
|||
[More-action]
|
||||
other = "Lainnya"
|
||||
|
||||
[Shortcuts-Title]
|
||||
[shortcuts-menuTitle]
|
||||
other = "Lainnya"
|
||||
|
||||
[Expand-title]
|
||||
|
|
|
@ -46,7 +46,7 @@ other = "Stampa l'intero capitolo"
|
|||
[More-action]
|
||||
other = "Altro"
|
||||
|
||||
[Shortcuts-Title]
|
||||
[shortcuts-menuTitle]
|
||||
other = "Altro"
|
||||
|
||||
[Expand-title]
|
||||
|
|
|
@ -46,7 +46,7 @@ other = "章全体を印刷する"
|
|||
[More-action]
|
||||
other = "更に"
|
||||
|
||||
[Shortcuts-Title]
|
||||
[shortcuts-menuTitle]
|
||||
other = "更に"
|
||||
|
||||
[Expand-title]
|
||||
|
|
|
@ -46,7 +46,7 @@ other = "전체 장 인쇄"
|
|||
[More-action]
|
||||
other = "외부 링크"
|
||||
|
||||
[Shortcuts-Title]
|
||||
[shortcuts-menuTitle]
|
||||
other = "외부 링크"
|
||||
|
||||
[Expand-title]
|
||||
|
|
|
@ -46,7 +46,7 @@ other = "Het hele hoofdstuk afdrukken"
|
|||
[More-action]
|
||||
other = "Snelkoppelingen"
|
||||
|
||||
[Shortcuts-Title]
|
||||
[shortcuts-menuTitle]
|
||||
other = "Snelkoppelingen"
|
||||
|
||||
[Expand-title]
|
||||
|
|
|
@ -46,7 +46,7 @@ other = "Drukowanie całego rozdziału"
|
|||
[More-action]
|
||||
other = "Więcej"
|
||||
|
||||
[Shortcuts-Title]
|
||||
[shortcuts-menuTitle]
|
||||
other = "Więcej"
|
||||
|
||||
[Expand-title]
|
||||
|
|
|
@ -46,7 +46,7 @@ other = "Imprimir capítulo inteiro"
|
|||
[More-action]
|
||||
other = "Mais"
|
||||
|
||||
[Shortcuts-Title]
|
||||
[shortcuts-menuTitle]
|
||||
other = "Mais"
|
||||
|
||||
[Expand-title]
|
||||
|
|
|
@ -46,7 +46,7 @@ other = "Tipărește întregul capitol"
|
|||
[More-action]
|
||||
other = "Mai mult"
|
||||
|
||||
[Shortcuts-Title]
|
||||
[shortcuts-menuTitle]
|
||||
other = "Mai mult"
|
||||
|
||||
[Expand-title]
|
||||
|
|
|
@ -46,7 +46,7 @@ other = "Печать всей главы"
|
|||
[More-action]
|
||||
other = "Еще"
|
||||
|
||||
[Shortcuts-Title]
|
||||
[shortcuts-menuTitle]
|
||||
other = "Еще"
|
||||
|
||||
[Expand-title]
|
||||
|
|
|
@ -46,7 +46,7 @@ other = "Chapisha sura nzima"
|
|||
[More-action]
|
||||
other = "Zaidi"
|
||||
|
||||
[Shortcuts-Title]
|
||||
[shortcuts-menuTitle]
|
||||
other = "Zaidi"
|
||||
|
||||
[Expand-title]
|
||||
|
|
|
@ -46,7 +46,7 @@ other = "Bölümün tamamını yazdır"
|
|||
[More-action]
|
||||
other = "Dahası Var"
|
||||
|
||||
[Shortcuts-Title]
|
||||
[shortcuts-menuTitle]
|
||||
other = "Dahası Var"
|
||||
|
||||
[Expand-title]
|
||||
|
|
|
@ -46,7 +46,7 @@ other = "In toàn bộ chương"
|
|||
[More-action]
|
||||
other = "Nội dung khác"
|
||||
|
||||
[Shortcuts-Title]
|
||||
[shortcuts-menuTitle]
|
||||
other = "Nội dung khác"
|
||||
|
||||
[Expand-title]
|
||||
|
|
|
@ -46,7 +46,7 @@ other = "打印整章"
|
|||
[More-action]
|
||||
other = "更多"
|
||||
|
||||
[Shortcuts-Title]
|
||||
[shortcuts-menuTitle]
|
||||
other = "更多"
|
||||
|
||||
[Expand-title]
|
||||
|
|
|
@ -46,7 +46,7 @@ other = "打印整章"
|
|||
[More-action]
|
||||
other = "更多"
|
||||
|
||||
[Shortcuts-Title]
|
||||
[shortcuts-menuTitle]
|
||||
other = "更多"
|
||||
|
||||
[Expand-title]
|
||||
|
|
|
@ -46,7 +46,7 @@ other = "列印整章"
|
|||
[More-action]
|
||||
other = "更多"
|
||||
|
||||
[Shortcuts-Title]
|
||||
[shortcuts-menuTitle]
|
||||
other = "更多"
|
||||
|
||||
[Expand-title]
|
||||
|
|
|
@ -46,7 +46,7 @@ other = "列印整章"
|
|||
[More-action]
|
||||
other = "更多"
|
||||
|
||||
[Shortcuts-Title]
|
||||
[shortcuts-menuTitle]
|
||||
other = "更多"
|
||||
|
||||
[Expand-title]
|
||||
|
|
|
@ -46,7 +46,7 @@ other = "打印整章"
|
|||
[More-action]
|
||||
other = "更多"
|
||||
|
||||
[Shortcuts-Title]
|
||||
[shortcuts-menuTitle]
|
||||
other = "更多"
|
||||
|
||||
[Expand-title]
|
||||
|
|
|
@ -20,39 +20,19 @@
|
|||
<hr class="padding">
|
||||
</div>
|
||||
<div id="R-content-wrapper" class="highlightable">
|
||||
<div id="R-topics">
|
||||
<ul class="enlarge morespace collapsible-menu">
|
||||
{{- $pages := partialCached "_relearn/pages.gotmpl" (dict "page" .Site.Home) .Site.Home.Path }}
|
||||
{{- $defaultAlwaysopen := .Site.Params.alwaysopen | default false }}
|
||||
{{- range $pages }}
|
||||
{{- $isSubSelf := eq . $currentNode }}
|
||||
{{- $isSubAncestor := and (not $isSubSelf) (.IsAncestor $currentNode) }}
|
||||
{{- $isSubHidden := or (.Params.hidden) (eq .Title "") }}
|
||||
{{- if or $isSubSelf $isSubAncestor }}
|
||||
{{- partial "partials/inline/menu-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)) }}
|
||||
{{- 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 }}
|
||||
<li>{{ $shortcut.Pre }}<a class="padding" href="{{ $shortcut.URL | relLangURL }}">{{ safeHTML $shortcut.Name }}</a>{{ $shortcut.Post }}</li>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
</ul>
|
||||
</div>
|
||||
{{- $menuconfigs := .Params.sidebarmenus | default site.Params.sidebarmenus | default (slice
|
||||
(dict "type" "page" "identifier" "home")
|
||||
(dict "type" "menu" "identifier" "shortcuts")
|
||||
) }}
|
||||
{{- range $menuconfigs }}
|
||||
{{- $config := . }}
|
||||
{{- if eq $config.type "page" }}
|
||||
{{- partial "partials/inline/page-tree" (dict "currentnode" $currentNode "config" $config "showvisitedlinks" $showvisitedlinks) }}
|
||||
{{- else if eq $config.type "menu" }}
|
||||
{{- partial "partials/inline/menu-tree" (dict "currentnode" $currentNode "config" $config "showvisitedlinks" $showvisitedlinks) }}
|
||||
{{- else }}
|
||||
{{- warnf "WARNING: unknown menu type '%s' found in parameter 'sidebarmenus' for menu '%s'; use either 'page' or 'menu'" $config.type $config.identifier }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $siteLanguages := .Site.Languages }}
|
||||
{{- $showlangswitch := and hugo.IsMultilingual (not .Site.Params.disableLanguageSwitchingButton) (gt (int (len $siteLanguages)) 1) }}
|
||||
|
@ -119,19 +99,58 @@
|
|||
</div>
|
||||
</div>
|
||||
</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 }}
|
||||
{{- $showvisitedlinks := .showvisitedlinks }}
|
||||
{{- $alwaysopen := .alwaysopen }}
|
||||
{{- $currentFileRelPermalink := .currentnode.RelPermalink }}
|
||||
{{- $isSelf := .isSelf }}
|
||||
{{- $isAncestor := .isAncestor }}
|
||||
{{- $isHidden := .isHidden }}
|
||||
{{- with .sect }}
|
||||
{{- $isActive := $isSelf }}
|
||||
{{- $pages := partialCached "_relearn/pages.gotmpl" (dict "page" .) .Path }}
|
||||
{{- $entry := . }}
|
||||
{{- $entries := partialCached "_relearn/pages.gotmpl" (dict "page" .) .Path }}
|
||||
{{- $hasVisibleChildren := false }}
|
||||
{{- range $pages }}
|
||||
{{- range $entries }}
|
||||
{{- $isSubSelf := eq . $currentNode }}
|
||||
{{- $isSubAncestor := and (not $isSubSelf) (.IsAncestor $currentNode) }}
|
||||
{{- $isSubHidden := or (.Params.hidden) (eq .Title "") }}
|
||||
|
@ -142,31 +161,164 @@
|
|||
{{- end }}
|
||||
{{- $title := partial "title.gotmpl" (dict "page" . "linkTitle" true) }}
|
||||
{{- $url := partial "permalink.gotmpl" (dict "to" .) }}
|
||||
{{- $pre := partial "menu-pre.html" . }}
|
||||
{{- $post := partial "menu-post.html" . }}
|
||||
{{- if $hasVisibleChildren }}
|
||||
{{- $isCollapsible := or .Params.collapsibleMenu .Site.Params.collapsibleMenu }}
|
||||
{{- $isCollapsible := .Params.collapsibleMenu | default site.Params.collapsibleMenu }}
|
||||
{{- $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 }}
|
||||
<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 }}
|
||||
{{- partial "menu-pre.html" . }}{{ $title }}{{ partial "menu-post.html" . }}
|
||||
{{- 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">
|
||||
{{- $defaultAlwaysopen := .Site.Params.alwaysopen | default true }}
|
||||
{{- range $pages }}
|
||||
{{- $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 . $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/menu-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)) }}
|
||||
{{- partialCached "partials/inline/menu-walker" (dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden) .Path }}
|
||||
{{- 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></li>
|
||||
{{- else }}
|
||||
{{- 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 }}
|
||||
{{- 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>
|
||||
{{- 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 := "" }}
|
||||
{{- 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 }}
|
||||
{{- if $.linkTitle }}
|
||||
{{- $siteTitle := or site.Params.linkTitle site.Title }}
|
||||
|
|
|
@ -1 +1 @@
|
|||
7.0.1+72a875f1db967152c77914cff4d53f8fcee0e619
|
||||
7.0.1+06e70da8a6fb2043fe7e56b818ff638a309c8239
|
|
@ -16,7 +16,7 @@ features = [
|
|||
'hidden pages',
|
||||
'i18n', 'icons', 'image resizing', 'include',
|
||||
'light', 'lightbox', 'logo',
|
||||
'math', 'mathjax', 'menu', 'mermaid', 'multilingual', 'mobile',
|
||||
'math', 'mathjax', 'menus', 'mermaid', 'multilingual', 'mobile',
|
||||
'nested menus', 'nested sections', 'notice',
|
||||
'oas', 'offline usable', 'openapi', 'open graph',
|
||||
'print', 'printable',
|
||||
|
|
Loading…
Reference in a new issue