Skip to content

Commit 4270532

Browse files
authored
Move post nav links to a partial section (#343)
1 parent 0f4dc88 commit 4270532

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

layouts/_default/single.html

+1-19
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,7 @@ <h1 class="post-title">
3737
</ul>
3838
{{- end }}
3939
{{- if (.Param "ShowPostNavLinks") }}
40-
{{- $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
41-
{{- if and (gt (len $pages) 1) (in $pages . ) }}
42-
<nav class="paginav">
43-
{{- with $pages.Next . }}
44-
<a class="prev" href="{{ .Permalink }}">
45-
<span class="title">« {{ i18n "prev_page" }}</span>
46-
<br>
47-
<span>{{- .Name -}}</span>
48-
</a>
49-
{{- end }}
50-
{{- with $pages.Prev . }}
51-
<a class="next" href="{{ .Permalink }}">
52-
<span class="title">{{ i18n "next_page" }} »</span>
53-
<br>
54-
<span>{{- .Name -}}</span>
55-
</a>
56-
{{- end }}
57-
</nav>
58-
{{- end }}
40+
{{- partial "post_nav_links.html" . }}
5941
{{- end }}
6042
{{- if (and .Site.Params.ShowShareButtons (ne .Params.disableShare true)) }}
6143
{{- partial "share_icons.html" . -}}

layouts/partials/post_nav_links.html

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{{- $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
2+
{{- if and (gt (len $pages) 1) (in $pages . ) }}
3+
<nav class="paginav">
4+
{{- with $pages.Next . }}
5+
<a class="prev" href="{{ .Permalink }}">
6+
<span class="title">« {{ i18n "prev_page" }}</span>
7+
<br>
8+
<span>{{- .Name -}}</span>
9+
</a>
10+
{{- end }}
11+
{{- with $pages.Prev . }}
12+
<a class="next" href="{{ .Permalink }}">
13+
<span class="title">{{ i18n "next_page" }} »</span>
14+
<br>
15+
<span>{{- .Name -}}</span>
16+
</a>
17+
{{- end }}
18+
</nav>
19+
{{- end }}

0 commit comments

Comments
 (0)