Add menu-pre and menu-post templates

This commit is contained in:
Helder Pereira 2021-08-25 09:05:36 +01:00
parent 2e445d2584
commit 6efb50a010
7 changed files with 8 additions and 8 deletions

View file

@ -1,8 +1,7 @@
+++ +++
chapter = true chapter = true
pre = "<b>1. </b>"
title = "Basics" title = "Basics"
weight = 5 weight = 1
+++ +++
### Chapter 1 ### Chapter 1

View file

@ -1,8 +1,7 @@
+++ +++
chapter = true chapter = true
pre = "<b>2. </b>"
title = "Content" title = "Content"
weight = 10 weight = 2
+++ +++
### Chapter 2 ### Chapter 2

View file

@ -1,8 +1,7 @@
+++ +++
chapter = true chapter = true
pre = "<b>3. </b>"
title = "Shortcodes" title = "Shortcodes"
weight = 15 weight = 3
+++ +++
### Chapter 3 ### Chapter 3

View file

@ -0,0 +1 @@
{{ if .Params.chapter }}<b>{{ .Params.weight }}. </b>{{ end }}

View file

@ -0,0 +1 @@
{{ .Params.Post | safeHTML }}

View file

@ -0,0 +1 @@
{{ .Params.Pre | safeHTML }}

View file

@ -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>