mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2025-03-19 15:49:32 +00:00
menu: allow menuPageRef, menu.pageRef and sidebarmenus.pageRef to point to resources #1008
This commit is contained in:
parent
14c19bb13c
commit
516e552ece
13 changed files with 76 additions and 56 deletions
|
@ -156,6 +156,12 @@ summaryLength = 10
|
||||||
identifier = 'frontmatter'
|
identifier = 'frontmatter'
|
||||||
title = 'Front Matter Reference'
|
title = 'Front Matter Reference'
|
||||||
pageRef = 'authoring/frontmatter/reference#annotated-front-matter'
|
pageRef = 'authoring/frontmatter/reference#annotated-front-matter'
|
||||||
|
[[languages.en.menu.devshortcuts]]
|
||||||
|
parent = 'theme'
|
||||||
|
pre = '<i class="fa-fw fas fa-image"></i> '
|
||||||
|
identifier = 'screenshotframe'
|
||||||
|
title = 'Screenshot Frame'
|
||||||
|
pageRef = 'images/hero.zip'
|
||||||
|
|
||||||
# this is ourrr way t' showcase th' multilang settings by
|
# this is ourrr way t' showcase th' multilang settings by
|
||||||
# doing autotrrranlat'n of th' english content; we are
|
# doing autotrrranlat'n of th' english content; we are
|
||||||
|
@ -228,6 +234,12 @@ summaryLength = 10
|
||||||
identifier = 'frontmatter'
|
identifier = 'frontmatter'
|
||||||
title = 'Front Matter Reference'
|
title = 'Front Matter Reference'
|
||||||
pageRef = 'authoring/frontmatter/reference#annotated-front-matter'
|
pageRef = 'authoring/frontmatter/reference#annotated-front-matter'
|
||||||
|
[[languages.pir.menu.devshortcuts]]
|
||||||
|
parent = 'theme'
|
||||||
|
pre = '<i class="fa-fw fas fa-image"></i> '
|
||||||
|
identifier = 'screenshotframe'
|
||||||
|
title = 'Screenshot Frame'
|
||||||
|
pageRef = 'images/hero.zip'
|
||||||
|
|
||||||
# mounts are only needed in this showcase to access the publicly available screenshots and CHANGELOG;
|
# mounts are only needed in this showcase to access the publicly available screenshots and CHANGELOG;
|
||||||
# remove this section if you don't need further mounts
|
# remove this section if you don't need further mounts
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{{- $href := partial "permalink.gotmpl" (dict "to" .linkPage) }}
|
{{- $href := partial "permalink.gotmpl" (dict "to" .linkObject) }}
|
||||||
{{- $silent := .silent | default false }}
|
{{- $silent := .silent | default false }}
|
||||||
{{- $hideFilepath := .hideFilepath | default false }}
|
{{- $hideFilepath := .hideFilepath | default false }}
|
||||||
{{- $u := urls.Parse .url }}
|
{{- $u := urls.Parse .url }}
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
{{- with $u.Fragment }}
|
{{- with $u.Fragment }}
|
||||||
{{- $href = printf "%s#%s" $href . }}
|
{{- $href = printf "%s#%s" $href . }}
|
||||||
{{- if not $silent }}
|
{{- if not $silent }}
|
||||||
{{- partial "inline/validate-fragment.html" (dict "origPage" $.page "page" $.linkPage "parsedURL" $u "url" $.url "param" $.param "hideFilepath" $hideFilepath) }}
|
{{- partial "inline/validate-fragment.html" (dict "origPage" $.page "page" $.linkObject "parsedURL" $u "url" $.url "param" $.param "hideFilepath" $hideFilepath) }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- return $href }}
|
{{- return $href }}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{{- $page := .page }}
|
{{- $page := .page }}
|
||||||
{{- $linkPage := "" }}
|
{{- $linkObject := "" }}
|
||||||
{{- $u := urls.Parse .url }}
|
{{- $u := urls.Parse .url }}
|
||||||
{{- $path := strings.TrimPrefix "./" $u.Path }}
|
{{- $path := strings.TrimPrefix "./" $u.Path }}
|
||||||
{{- $searchLocal := .searchLocal | default true }}
|
{{- $searchLocal := .searchLocal | default true }}
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
(and $searchLocal $searchResource ($page.Page.Resources.Get $path))
|
(and $searchLocal $searchResource ($page.Page.Resources.Get $path))
|
||||||
(and $searchGlobal $searchResource (resources.Get $path))
|
(and $searchGlobal $searchResource (resources.Get $path))
|
||||||
}}
|
}}
|
||||||
{{- $linkPage = . }}
|
{{- $linkObject = . }}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
{{- /* is it a link into another translation? */}}
|
{{- /* is it a link into another translation? */}}
|
||||||
{{- if strings.HasPrefix $path "/" }}
|
{{- if strings.HasPrefix $path "/" }}
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
(and $searchLocal $searchResource (.Resources.Get $suffix))
|
(and $searchLocal $searchResource (.Resources.Get $suffix))
|
||||||
(and $searchGlobal $searchResource (resources.Get $suffix))
|
(and $searchGlobal $searchResource (resources.Get $suffix))
|
||||||
}}
|
}}
|
||||||
{{- $linkPage = . }}
|
{{- $linkObject = . }}
|
||||||
{{- break }}
|
{{- break }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
@ -43,6 +43,6 @@
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
{{- $linkPage = $page.Page }}
|
{{- $linkObject = $page.Page }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- return $linkPage }}
|
{{- return $linkObject }}
|
5
layouts/partials/_relearn/menuObject.gotmpl
Normal file
5
layouts/partials/_relearn/menuObject.gotmpl
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{{- $linkObject := "" }}
|
||||||
|
{{- with and . .menu }}
|
||||||
|
{{- $linkObject = partial "_relearn/refObject.gotmpl" (dict "page" $.page "objectRef" .PageRef "refObject" .Page "searchPage" $.searchPage "searchResource" $.searchResource) }}
|
||||||
|
{{- end }}
|
||||||
|
{{- return $linkObject }}
|
|
@ -1,5 +0,0 @@
|
||||||
{{- $linkPage := "" }}
|
|
||||||
{{- with and . .menu }}
|
|
||||||
{{- $linkPage = partial "_relearn/refPage.gotmpl" (dict "page" $.page "pageRef" .PageRef "refPage" .Page) }}
|
|
||||||
{{- end }}
|
|
||||||
{{- return $linkPage }}
|
|
|
@ -4,9 +4,9 @@
|
||||||
{{- with and . .menu }}
|
{{- with and . .menu }}
|
||||||
{{- if .PageRef }}
|
{{- if .PageRef }}
|
||||||
{{- $url = .PageRef }}
|
{{- $url = .PageRef }}
|
||||||
{{- $linkPage := partial "_relearn/refPage.gotmpl" (dict "page" $.page "pageRef" .PageRef "refPage" .Page) }}
|
{{- $linkObject := partial "_relearn/refObject.gotmpl" (dict "page" $.page "objectRef" .PageRef "refObject" .Page) }}
|
||||||
{{- if $linkPage }}
|
{{- if $linkObject }}
|
||||||
{{- $url = partial "_relearn/decoratedLink.gotmpl" (dict "url" .PageRef "page" $.page "linkPage" $linkPage "param" "link" "hideFilepath" true) }}
|
{{- $url = partial "_relearn/decoratedLink.gotmpl" (dict "url" .PageRef "page" $.page "linkObject" $linkObject "param" "link" "hideFilepath" true) }}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
{{- $msg := printf "config option 'pageRef' %q for 'menu' entry %q is not a page or a resource" .PageRef (or .KeyName .Identifier .Name .Title) }}
|
{{- $msg := printf "config option 'pageRef' %q for 'menu' entry %q is not a page or a resource" .PageRef (or .KeyName .Identifier .Name .Title) }}
|
||||||
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" .PageRef "page" $.page "param" "link" "msg" $msg) }}
|
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" .PageRef "page" $.page "param" "link" "msg" $msg) }}
|
||||||
|
|
|
@ -1,10 +1,18 @@
|
||||||
{{- $title := "" }}
|
{{- $title := "" }}
|
||||||
{{- with and . .menu }}
|
{{- with and . .menu }}
|
||||||
{{- $pagetitle := "" }}
|
{{- $objectTitle := "" }}
|
||||||
{{- $menuPage := partial "_relearn/menuPage.gotmpl" (dict "page" $.page "menu" .) }}
|
{{- $menuPage := partial "_relearn/menuObject.gotmpl" (dict "page" $.page "menu" . "searchResource" false) }}
|
||||||
{{- with $menuPage }}
|
{{- with $menuPage }}
|
||||||
{{- $pagetitle = or .LinkTitle .Title }}
|
{{- $objectTitle = or .LinkTitle .Title }}
|
||||||
|
{{- else }}
|
||||||
|
{{- $menuResource := partial "_relearn/menuObject.gotmpl" (dict "page" $.page "menu" . "searchPage" false) }}
|
||||||
|
{{- with $menuResource }}
|
||||||
|
{{- $objectTitle = .Title }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- $title = or .Title (.Name | safeHTML) (.Identifier | safeHTML) }}
|
||||||
|
{{- if and (eq $objectTitle .Title) (ne .Name .Title) }}
|
||||||
|
{{- $title = (.Name | safeHTML) }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $title = or .Title $pagetitle (.Name | safeHTML) (.Identifier | safeHTML) }}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- return $title }}
|
{{- return $title }}
|
11
layouts/partials/_relearn/refObject.gotmpl
Normal file
11
layouts/partials/_relearn/refObject.gotmpl
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{{- $linkObject := "" }}
|
||||||
|
{{- /* because Hugo can not resolve a pageRef if it contains URL query params or
|
||||||
|
fragments, we do it ourself if we detect such a case */}}
|
||||||
|
{{- with .refObject }}
|
||||||
|
{{- $linkObject = . }}
|
||||||
|
{{- else }}
|
||||||
|
{{- with .objectRef }}
|
||||||
|
{{- $linkObject = partial "_relearn/linkObject.gotmpl" (dict "url" . "page" $.page "searchLocal" false "searchPage" $.searchPage "searchResource" $.searchResource) }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- return $linkObject }}
|
|
@ -1,11 +0,0 @@
|
||||||
{{- $linkPage := "" }}
|
|
||||||
{{- /* because Hugo can not resolve a pageRef if it contains URL query params or
|
|
||||||
fragments, we do it ourself if we detect such a case */}}
|
|
||||||
{{- with .refPage }}
|
|
||||||
{{- $linkPage = . }}
|
|
||||||
{{- else }}
|
|
||||||
{{- with .pageRef }}
|
|
||||||
{{- $linkPage = partial "_relearn/linkPage.gotmpl" (dict "url" . "page" $.page "searchLocal" false) }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
{{- return $linkPage }}
|
|
|
@ -105,15 +105,15 @@
|
||||||
{{- $config := .config }}
|
{{- $config := .config }}
|
||||||
{{- $showvisitedlinks := .showvisitedlinks }}
|
{{- $showvisitedlinks := .showvisitedlinks }}
|
||||||
<div id="R-shortcutmenu-{{ $config.identifier }}" class="R-sidebarmenu">
|
<div id="R-shortcutmenu-{{ $config.identifier }}" class="R-sidebarmenu">
|
||||||
{{- $root := site.Home }}
|
{{- $rootObject := site.Home }}
|
||||||
{{- if $config.pageRef }}
|
{{- if $config.pageRef }}
|
||||||
{{- $root = partial "_relearn/refPage.gotmpl" (dict "page" $currentNode "pageRef" $config.pageRef) }}
|
{{- $rootObject = partial "_relearn/refObject.gotmpl" (dict "page" $currentNode "objectRef" $config.pageRef) }}
|
||||||
{{- if not $root }}
|
{{- if not $rootObject }}
|
||||||
{{- $msg := printf "config option 'pageRef' %q for 'sidebarmenus' %q is not a page or a resource" $config.pageRef $config.identifier }}
|
{{- $msg := printf "config option 'pageRef' %q for 'sidebarmenus' %q is not a page or a resource" $config.pageRef $config.identifier }}
|
||||||
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" $config.pageRef "page" $currentNode "param" "link" "msg" $msg) }}
|
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" $config.pageRef "page" $currentNode "param" "link" "msg" $msg) }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- with $root }}
|
{{- with $rootObject }}
|
||||||
{{- $entry := . }}
|
{{- $entry := . }}
|
||||||
{{- $entries := partialCached "_relearn/pages.gotmpl" (dict "page" $entry) $entry.Path }}
|
{{- $entries := partialCached "_relearn/pages.gotmpl" (dict "page" $entry) $entry.Path }}
|
||||||
{{- $title := "" }}
|
{{- $title := "" }}
|
||||||
|
@ -173,9 +173,9 @@
|
||||||
{{- if .Params.menuPageRef }}
|
{{- if .Params.menuPageRef }}
|
||||||
{{- $isCrosslink = true }}
|
{{- $isCrosslink = true }}
|
||||||
{{- $url = .Params.menuPageRef }}
|
{{- $url = .Params.menuPageRef }}
|
||||||
{{- $linkPage := partial "_relearn/refPage.gotmpl" (dict "page" . "pageRef" .Params.menuPageRef) }}
|
{{- $linkObject := partial "_relearn/refObject.gotmpl" (dict "page" . "objectRef" .Params.menuPageRef) }}
|
||||||
{{- if $linkPage }}
|
{{- if $linkObject }}
|
||||||
{{- $url = partial "_relearn/decoratedLink.gotmpl" (dict "url" .Params.menuPageRef "page" . "linkPage" $linkPage "param" "link" "silent" true) }}
|
{{- $url = partial "_relearn/decoratedLink.gotmpl" (dict "url" .Params.menuPageRef "page" . "linkObject" $linkObject "param" "link" "silent" true) }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- else if .Params.menuUrl }}
|
{{- else if .Params.menuUrl }}
|
||||||
{{- $isCrosslink = true }}
|
{{- $isCrosslink = true }}
|
||||||
|
@ -232,7 +232,7 @@
|
||||||
{{- with index site.Menus $config.identifier }}
|
{{- with index site.Menus $config.identifier }}
|
||||||
<div id="R-shortcutmenu-{{ $config.identifier }}" class="R-sidebarmenu">
|
<div id="R-shortcutmenu-{{ $config.identifier }}" class="R-sidebarmenu">
|
||||||
{{- $topLevelMenu := "" }}
|
{{- $topLevelMenu := "" }}
|
||||||
{{- $topLevelPage := "" }}
|
{{- $topLevelObject := "" }}
|
||||||
{{- $entries := . }}
|
{{- $entries := . }}
|
||||||
{{- with and (eq (len $entries) 1) (index $entries 0) }}
|
{{- with and (eq (len $entries) 1) (index $entries 0) }}
|
||||||
{{- if and (not .PageRef) (not .URL) }}
|
{{- if and (not .PageRef) (not .URL) }}
|
||||||
|
@ -241,7 +241,7 @@
|
||||||
entry carrys just meta information and parameter, uses its children
|
entry carrys just meta information and parameter, uses its children
|
||||||
to build the "real" menu, and has no own `url` or `pageRef` */}}
|
to build the "real" menu, and has no own `url` or `pageRef` */}}
|
||||||
{{- $topLevelMenu = . }}
|
{{- $topLevelMenu = . }}
|
||||||
{{- $topLevelPage = partial "_relearn/menuPage.gotmpl" (dict "page" $currentNode "menu" $topLevelMenu) }}
|
{{- $topLevelObject = partial "_relearn/menuObject.gotmpl" (dict "page" $currentNode "menu" $topLevelMenu) }}
|
||||||
{{- $entries = .Children }}
|
{{- $entries = .Children }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
@ -268,14 +268,14 @@
|
||||||
{{- $root := or $topLevelMenu site }}
|
{{- $root := or $topLevelMenu site }}
|
||||||
{{- $defaultAlwaysopen := site.Params.alwaysopen | default false }}
|
{{- $defaultAlwaysopen := site.Params.alwaysopen | default false }}
|
||||||
{{- range $entries }}
|
{{- range $entries }}
|
||||||
{{- $entriesPage := partial "_relearn/menuPage.gotmpl" (dict "page" $currentNode "menu" .) }}
|
{{- $entriesObject := partial "_relearn/menuObject.gotmpl" (dict "page" $currentNode "menu" .) }}
|
||||||
{{- $isSubSelf := eq $entriesPage $currentNode }}
|
{{- $isSubSelf := eq $entriesObject $currentNode }}
|
||||||
{{- $isSubAncestor := and (not $isSubSelf) ($currentNode.HasMenuCurrent .Menu .) }}
|
{{- $isSubAncestor := and (not $isSubSelf) ($currentNode.HasMenuCurrent .Menu .) }}
|
||||||
{{- $isSubHidden := or (.Params.hidden) (eq (partial "_relearn/menuTitle.gotmpl" (dict "page" $currentNode "menu" .)) "") }}
|
{{- $isSubHidden := or (.Params.hidden) (eq (partial "_relearn/menuTitle.gotmpl" (dict "page" $currentNode "menu" .)) "") }}
|
||||||
{{- $isSubCollapsible := .Params.collapsibleMenu | default $root.Params.collapsibleMenu | default site.Params.collapsibleMenu }}
|
{{- $isSubCollapsible := .Params.collapsibleMenu | default $root.Params.collapsibleMenu | default site.Params.collapsibleMenu }}
|
||||||
{{- if or $isSubSelf $isSubAncestor }}
|
{{- 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) }}
|
{{- 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 "_relearn/menuPermalink.gotmpl" (dict "page" $currentNode "menu" $topLevelMenu))) (eq $topLevelPage $currentNode) (and $topLevelMenu ($currentNode.HasMenuCurrent $topLevelMenu.Menu $topLevelMenu))) }}
|
{{- else if and (not $isSubHidden) (or $isSubCollapsible (not (partial "_relearn/menuPermalink.gotmpl" (dict "page" $currentNode "menu" $topLevelMenu))) (eq $topLevelObject $currentNode) (and $topLevelMenu ($currentNode.HasMenuCurrent $topLevelMenu.Menu $topLevelMenu))) }}
|
||||||
{{- $id := md5 (print .) }}
|
{{- $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 }}
|
{{- partialCached "partials/inline/menu-walker" (dict "menu" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden "root" $root) $id }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
@ -300,12 +300,12 @@
|
||||||
{{- with .menu }}
|
{{- with .menu }}
|
||||||
{{- $isActive := $isSelf }}
|
{{- $isActive := $isSelf }}
|
||||||
{{- $entryMenu := . }}
|
{{- $entryMenu := . }}
|
||||||
{{- $entryPage := partial "_relearn/menuPage.gotmpl" (dict "page" $currentNode "menu" $entryMenu) }}
|
{{- $entryObject := partial "_relearn/menuObject.gotmpl" (dict "page" $currentNode "menu" $entryMenu) }}
|
||||||
{{- $entries := .Children }}
|
{{- $entries := .Children }}
|
||||||
{{- $hasVisibleChildren := false }}
|
{{- $hasVisibleChildren := false }}
|
||||||
{{- range $entries }}
|
{{- range $entries }}
|
||||||
{{- $entriesPage := partial "_relearn/menuPage.gotmpl" (dict "page" $currentNode "menu" .) }}
|
{{- $entriesObject := partial "_relearn/menuObject.gotmpl" (dict "page" $currentNode "menu" .) }}
|
||||||
{{- $isSubSelf := eq $entriesPage $currentNode }}
|
{{- $isSubSelf := eq $entriesObject $currentNode }}
|
||||||
{{- $isSubAncestor := and (not $isSubSelf) ($currentNode.HasMenuCurrent .Menu .) }}
|
{{- $isSubAncestor := and (not $isSubSelf) ($currentNode.HasMenuCurrent .Menu .) }}
|
||||||
{{- $isSubHidden := or (.Params.hidden) (eq (partial "_relearn/menuTitle.gotmpl" (dict "page" $currentNode "menu" .)) "") }}
|
{{- $isSubHidden := or (.Params.hidden) (eq (partial "_relearn/menuTitle.gotmpl" (dict "page" $currentNode "menu" .)) "") }}
|
||||||
{{- if or $isSubAncestor $isSubSelf (not $isSubHidden) }}
|
{{- if or $isSubAncestor $isSubSelf (not $isSubHidden) }}
|
||||||
|
@ -325,7 +325,7 @@
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $pre := .Pre }}
|
{{- $pre := .Pre }}
|
||||||
{{- $post := .Post }}
|
{{- $post := .Post }}
|
||||||
{{- with $entryPage }}
|
{{- with $entryObject }}
|
||||||
{{- $pre = or $pre (partial "menu-pre.html" .) }}
|
{{- $pre = or $pre (partial "menu-pre.html" .) }}
|
||||||
{{- $post = or $post (partial "menu-post.html" .) }}
|
{{- $post = or $post (partial "menu-post.html" .) }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
@ -344,14 +344,14 @@
|
||||||
{{- 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">
|
{{- 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 $entries }}
|
{{- range $entries }}
|
||||||
{{- $entriesPage := partial "_relearn/menuPage.gotmpl" (dict "page" $currentNode "menu" .) }}
|
{{- $entriesObject := partial "_relearn/menuObject.gotmpl" (dict "page" $currentNode "menu" .) }}
|
||||||
{{- $isSubSelf := eq $entriesPage $currentNode }}
|
{{- $isSubSelf := eq $entriesObject $currentNode }}
|
||||||
{{- $isSubAncestor := and (not $isSubSelf) ($currentNode.HasMenuCurrent .Menu .) }}
|
{{- $isSubAncestor := and (not $isSubSelf) ($currentNode.HasMenuCurrent .Menu .) }}
|
||||||
{{- $isSubHidden := or (.Params.hidden) (eq (partial "_relearn/menuTitle.gotmpl" (dict "page" $currentNode "menu" .)) "") }}
|
{{- $isSubHidden := or (.Params.hidden) (eq (partial "_relearn/menuTitle.gotmpl" (dict "page" $currentNode "menu" .)) "") }}
|
||||||
{{- $isSubCollapsible := .Params.collapsibleMenu | default $root.Params.collapsibleMenu | default site.Params.collapsibleMenu }}
|
{{- $isSubCollapsible := .Params.collapsibleMenu | default $root.Params.collapsibleMenu | default site.Params.collapsibleMenu }}
|
||||||
{{- if or $isSubSelf $isSubAncestor }}
|
{{- 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) }}
|
{{- 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 "_relearn/menuPermalink.gotmpl" (dict "page" $currentNode "menu" $entryMenu))) (eq $entryPage $currentNode) ($currentNode.HasMenuCurrent $entryMenu.Menu $entryMenu)) }}
|
{{- else if and (not $isSubHidden) (or $isSubCollapsible (not (partial "_relearn/menuPermalink.gotmpl" (dict "page" $currentNode "menu" $entryMenu))) (eq $entryObject $currentNode) ($currentNode.HasMenuCurrent $entryMenu.Menu $entryMenu)) }}
|
||||||
{{- $id := md5 (print .) }}
|
{{- $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 }}
|
{{- partialCached "partials/inline/menu-walker" (dict "menu" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen "isSelf" $isSubSelf "isAncestor" $isSubAncestor "isHidden" $isSubHidden "root" $root) $id }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
|
@ -19,9 +19,9 @@
|
||||||
{{- $errorlevel := or .Params.link.errorlevel .Site.Params.link.errorlevel }}
|
{{- $errorlevel := or .Params.link.errorlevel .Site.Params.link.errorlevel }}
|
||||||
{{- if .Params.menuPageRef }}
|
{{- if .Params.menuPageRef }}
|
||||||
{{- $url = .Params.menuPageRef }}
|
{{- $url = .Params.menuPageRef }}
|
||||||
{{- $linkPage := partial "_relearn/refPage.gotmpl" (dict "page" . "pageRef" .Params.menuPageRef) }}
|
{{- $linkObject := partial "_relearn/refObject.gotmpl" (dict "page" . "objectRef" .Params.menuPageRef) }}
|
||||||
{{- if $linkPage }}
|
{{- if $linkObject }}
|
||||||
{{- $url = partial "_relearn/decoratedLink.gotmpl" (dict "url" .Params.menuPageRef "page" . "linkPage" $linkPage "param" "link") }}
|
{{- $url = partial "_relearn/decoratedLink.gotmpl" (dict "url" .Params.menuPageRef "page" . "linkObject" $linkObject "param" "link") }}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
{{- $msg := printf "%q: front matter 'menuPageRef' %q is not a page or a resource" $filepath .Params.menuPageRef }}
|
{{- $msg := printf "%q: front matter 'menuPageRef' %q is not a page or a resource" $filepath .Params.menuPageRef }}
|
||||||
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" .Params.menuPageRef "page" . "param" "link" "msg" $msg) }}
|
{{- partial "_relearn/urlErrorReport.gotmpl" (dict "url" .Params.menuPageRef "page" . "param" "link" "msg" $msg) }}
|
||||||
|
|
|
@ -26,9 +26,9 @@
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $attributes = $attributes | merge (dict "target" $target) }}
|
{{- $attributes = $attributes | merge (dict "target" $target) }}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
{{- $linkPage := partial "_relearn/linkPage.gotmpl" (dict "url" $.url "page" $page) }}
|
{{- $linkObject := partial "_relearn/linkObject.gotmpl" (dict "url" $.url "page" $page) }}
|
||||||
{{- with $linkPage }}
|
{{- with $linkObject }}
|
||||||
{{- $href = partial "_relearn/decoratedLink.gotmpl" (dict "url" $.url "page" $page "linkPage" . "param" "link") }}
|
{{- $href = partial "_relearn/decoratedLink.gotmpl" (dict "url" $.url "page" $page "linkObject" . "param" "link") }}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
{{- $filepath := "[virtual file]" }}{{ with and $page $page.File $page.File.Filename }}{{ $filepath = . }}{{ end }}
|
||||||
{{- $msg := printf "%q: link '%s' is not a page or a resource" $filepath .url }}
|
{{- $msg := printf "%q: link '%s' is not a page or a resource" $filepath .url }}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
7.3.2+66bc366c4727a958f3873f409550daa36932c03f
|
7.3.2+14c19bb13cecd2d3e72f5f53ad2b03f71dfcef81
|
Loading…
Add table
Reference in a new issue