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
|
chapter = true
|
||||||
pre = "<b>1. </b>"
|
|
||||||
title = "Basics"
|
title = "Basics"
|
||||||
weight = 5
|
weight = 1
|
||||||
+++
|
+++
|
||||||
|
|
||||||
### Chapter 1
|
### Chapter 1
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
+++
|
+++
|
||||||
chapter = true
|
chapter = true
|
||||||
pre = "<b>2. </b>"
|
|
||||||
title = "Content"
|
title = "Content"
|
||||||
weight = 10
|
weight = 2
|
||||||
+++
|
+++
|
||||||
|
|
||||||
### Chapter 2
|
### Chapter 2
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
+++
|
+++
|
||||||
chapter = true
|
chapter = true
|
||||||
pre = "<b>3. </b>"
|
|
||||||
title = "Shortcodes"
|
title = "Shortcodes"
|
||||||
weight = 15
|
weight = 3
|
||||||
+++
|
+++
|
||||||
|
|
||||||
### Chapter 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 }}
|
{{ $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}}">
|
<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}}">
|
<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}}
|
{{ if $showvisitedlinks}}<i class="fas fa-check read-icon"></i>{{end}}
|
||||||
</a>
|
</a>
|
||||||
{{ $numberOfPages := (add (len ( where .Pages "Params.hidden" "ne" true )) (len ( where .Sections "Params.hidden" "ne" true ))) }}
|
{{ $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 }}
|
{{else if not .Params.Hidden }}
|
||||||
<li data-nav-id="{{.RelPermalink}}" title="{{.Title}}" class="dd-item{{if eq .File.UniqueID $currentFileUniqueID}} active{{end}}">
|
<li data-nav-id="{{.RelPermalink}}" title="{{.Title}}" class="dd-item{{if eq .File.UniqueID $currentFileUniqueID}} active{{end}}">
|
||||||
<a href="{{ .RelPermalink}}">
|
<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}}
|
{{ if $showvisitedlinks}}<i class="fas fa-check read-icon"></i>{{end}}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
Loading…
Reference in a new issue