Personnalisation du bandeau de pagination
This commit is contained in:
parent
e77784f1dc
commit
d6f2b2b9fd
2 changed files with 58 additions and 0 deletions
14
layouts/a-propos.html
Normal file
14
layouts/a-propos.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
{{ define "main" }}
|
||||
{{- if .Site.Home.Content -}}
|
||||
{{- .Site.Home.Content -}}
|
||||
{{- partial "edit-meta.html" . -}}
|
||||
{{- else -}}
|
||||
<h1>Customize your own home page</h1>
|
||||
<p>The site is working. Don't forget to customize this homepage with your own. You typically have 2 choices :</p>
|
||||
<ol>
|
||||
<li>Create an _index.md document in <b>content</b> folder and fill it with Markdown content</li>
|
||||
<li>Create an <b>index.html</b> file in the <b>static</b> folder and fill the file with HTML content</li>
|
||||
<li>Configure your server to automatically redirect home page to one your documentation page</li>
|
||||
</ol>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
44
layouts/partials/pagination.html
Normal file
44
layouts/partials/pagination.html
Normal file
|
@ -0,0 +1,44 @@
|
|||
{{- $currentNode := . -}}
|
||||
<nav class="pagination">
|
||||
{{- template "pagination" dict "menu" .Site.Home "currentnode" $currentNode "menu_exclusion" .Site.Params.menu_exclusion -}}
|
||||
{{- with ($.Scratch.Get "prevPage") -}}
|
||||
<a class="nav nav-prev" href="{{ .Permalink }}" title="{{ .Title }}"><i class="fas fa-arrow-left" aria-hidden="true"></i> Précédent - {{ .Title }}</a>
|
||||
{{ end -}}
|
||||
{{- with ($.Scratch.Get "nextPage") -}}
|
||||
<a class="nav nav-next" href="{{ .Permalink }}" title="{{ .Title }}">Suivant - {{ .Title }} <i class="fas fa-arrow-right" aria-hidden="true"></i></a>
|
||||
{{- end }}
|
||||
</nav>
|
||||
|
||||
{{- define "pagination" -}}
|
||||
{{- $currentNode := .currentnode -}}
|
||||
{{- $menu_exclusion := .menu_exclusion -}}
|
||||
|
||||
{{- if hasPrefix $currentNode.Permalink .menu.Permalink -}}
|
||||
{{- $currentNode.Scratch.Set "NextPageOK" "OK" -}}
|
||||
{{- if .menu.IsHome -}}
|
||||
{{- $currentNode.Scratch.Set "prevPage" "" -}}
|
||||
{{- else -}}
|
||||
{{- $currentNode.Scratch.Set "prevPage" ($currentNode.Scratch.Get "prevPageTmp") -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- if eq ($currentNode.Scratch.Get "NextPageOK") "OK" -}}
|
||||
{{- $currentNode.Scratch.Set "NextPageOK" nil -}}
|
||||
{{ if in $menu_exclusion .menu.Section }}
|
||||
{{- else -}}
|
||||
{{- $currentNode.Scratch.Set "nextPage" .menu -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $currentNode.Scratch.Set "prevPageTmp" .menu -}}
|
||||
{{- $currentNode.Scratch.Set "pages" .menu.Pages -}}
|
||||
{{- if .menu.IsHome -}}
|
||||
{{- $currentNode.Scratch.Set "pages" .menu.Sections -}}
|
||||
{{- else if .menu.Sections -}}
|
||||
{{- $currentNode.Scratch.Set "pages" (.menu.Pages | union .menu.Sections) -}}
|
||||
{{- end -}}
|
||||
{{- $pages := ($currentNode.Scratch.Get "pages") -}}
|
||||
{{- range $pages.ByWeight -}}
|
||||
{{- template "pagination" dict "menu" . "currentnode" $currentNode "menu_exclusion" $menu_exclusion -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
Loading…
Add table
Add a link
Reference in a new issue