Move post nav links to a partial section (#343)

This commit is contained in:
Mohammad Noor Abu Khleif 2021-04-09 12:25:56 +03:00 committed by GitHub
parent 0f4dc88c63
commit 427053290d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 19 deletions

View File

@ -37,25 +37,7 @@
</ul>
{{- end }}
{{- if (.Param "ShowPostNavLinks") }}
{{- $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
{{- if and (gt (len $pages) 1) (in $pages . ) }}
<nav class="paginav">
{{- with $pages.Next . }}
<a class="prev" href="{{ .Permalink }}">
<span class="title">« {{ i18n "prev_page" }}</span>
<br>
<span>{{- .Name -}}</span>
</a>
{{- end }}
{{- with $pages.Prev . }}
<a class="next" href="{{ .Permalink }}">
<span class="title">{{ i18n "next_page" }} »</span>
<br>
<span>{{- .Name -}}</span>
</a>
{{- end }}
</nav>
{{- end }}
{{- partial "post_nav_links.html" . }}
{{- end }}
{{- if (and .Site.Params.ShowShareButtons (ne .Params.disableShare true)) }}
{{- partial "share_icons.html" . -}}

View File

@ -0,0 +1,19 @@
{{- $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
{{- if and (gt (len $pages) 1) (in $pages . ) }}
<nav class="paginav">
{{- with $pages.Next . }}
<a class="prev" href="{{ .Permalink }}">
<span class="title">« {{ i18n "prev_page" }}</span>
<br>
<span>{{- .Name -}}</span>
</a>
{{- end }}
{{- with $pages.Prev . }}
<a class="next" href="{{ .Permalink }}">
<span class="title">{{ i18n "next_page" }} »</span>
<br>
<span>{{- .Name -}}</span>
</a>
{{- end }}
</nav>
{{- end }}