mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
Add menu-pre and menu-post templates
This commit is contained in:
parent
2e445d2584
commit
6efb50a010
7 changed files with 8 additions and 8 deletions
|
@ -1,8 +1,7 @@
|
|||
+++
|
||||
chapter = true
|
||||
pre = "<b>1. </b>"
|
||||
title = "Basics"
|
||||
weight = 5
|
||||
weight = 1
|
||||
+++
|
||||
|
||||
### Chapter 1
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
+++
|
||||
chapter = true
|
||||
pre = "<b>2. </b>"
|
||||
title = "Content"
|
||||
weight = 10
|
||||
weight = 2
|
||||
+++
|
||||
|
||||
### Chapter 2
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
+++
|
||||
chapter = true
|
||||
pre = "<b>3. </b>"
|
||||
title = "Shortcodes"
|
||||
weight = 15
|
||||
weight = 3
|
||||
+++
|
||||
|
||||
### Chapter 3
|
||||
|
|
1
exampleSite/layouts/partials/menu-pre.html
Normal file
1
exampleSite/layouts/partials/menu-pre.html
Normal file
|
@ -0,0 +1 @@
|
|||
{{ if .Params.chapter }}<b>{{ .Params.weight }}. </b>{{ end }}
|
1
layouts/partials/menu-post.html
Normal file
1
layouts/partials/menu-post.html
Normal file
|
@ -0,0 +1 @@
|
|||
{{ .Params.Post | safeHTML }}
|
1
layouts/partials/menu-pre.html
Normal file
1
layouts/partials/menu-pre.html
Normal file
|
@ -0,0 +1 @@
|
|||
{{ .Params.Pre | safeHTML }}
|
|
@ -110,7 +110,7 @@
|
|||
{{ $currentAlwaysopen := .Params.alwaysopen | default $alwaysopen }}
|
||||
<li data-nav-id="{{.RelPermalink}}" title="{{.Title}}" class="dd-item{{if eq .File.UniqueID $currentFileUniqueID}} active{{else if .IsAncestor $currentNode }} parent{{else if $currentAlwaysopen}} parent{{end}}">
|
||||
<a href="{{.RelPermalink}}">
|
||||
{{safeHTML .Params.Pre}}{{or .Params.menuTitle .LinkTitle .Title}}{{safeHTML .Params.Post}}
|
||||
{{ partial "menu-pre.html" . }}{{or .Params.menuTitle .LinkTitle .Title}}{{ partial "menu-post.html" . }}
|
||||
{{ if $showvisitedlinks}}<i class="fas fa-check read-icon"></i>{{end}}
|
||||
</a>
|
||||
{{ $numberOfPages := (add (len ( where .Pages "Params.hidden" "ne" true )) (len ( where .Sections "Params.hidden" "ne" true ))) }}
|
||||
|
@ -143,7 +143,7 @@
|
|||
{{else if not .Params.Hidden }}
|
||||
<li data-nav-id="{{.RelPermalink}}" title="{{.Title}}" class="dd-item{{if eq .File.UniqueID $currentFileUniqueID}} active{{end}}">
|
||||
<a href="{{ .RelPermalink}}">
|
||||
{{safeHTML .Params.Pre}}{{or .Params.menuTitle .LinkTitle .Title}}{{safeHTML .Params.Post}}
|
||||
{{ partial "menu-pre.html" . }}{{or .Params.menuTitle .LinkTitle .Title}}{{ partial "menu-post.html" . }}
|
||||
{{ if $showvisitedlinks}}<i class="fas fa-check read-icon"></i>{{end}}
|
||||
</a>
|
||||
</li>
|
||||
|
|
Loading…
Reference in a new issue