mirror of
https://github.com/adityatelange/hugo-PaperMod.git
synced 2024-12-26 15:05:52 -05:00
init feat Prev Next post links on single post page (#180)
usage => in site config add Params: ShowPostNavLinks: true
This commit is contained in:
parent
3c3888f7ad
commit
778ee39137
@ -294,7 +294,8 @@
|
||||
}
|
||||
|
||||
.post-tags a,
|
||||
.share-buttons {
|
||||
.share-buttons,
|
||||
.paginav {
|
||||
border-radius: var(--radius);
|
||||
background: var(--code-bg);
|
||||
border: 1px solid var(--border)
|
||||
@ -310,7 +311,8 @@
|
||||
background: var(--code-bg)
|
||||
}
|
||||
|
||||
.post-tags a:hover {
|
||||
.post-tags a:hover,
|
||||
.paginav a:hover {
|
||||
background: var(--border)
|
||||
}
|
||||
|
||||
@ -374,3 +376,41 @@ h6:hover .anchor {
|
||||
.post-content table::-webkit-scrollbar-thumb {
|
||||
border-width: 2px;
|
||||
}
|
||||
|
||||
.paginav {
|
||||
margin: 10px 0;
|
||||
display: flex;
|
||||
line-height: 30px;
|
||||
border-radius: var(--radius);
|
||||
}
|
||||
|
||||
.paginav a {
|
||||
padding-inline-start: 14px;
|
||||
padding-inline-end: 14px;
|
||||
border-radius: var(--radius);
|
||||
}
|
||||
|
||||
.paginav .title {
|
||||
letter-spacing: 1px;
|
||||
text-transform: uppercase;
|
||||
font-size: small;
|
||||
color: var(--secondary);
|
||||
}
|
||||
|
||||
.paginav .prev,
|
||||
.paginav .next {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.paginav span:hover:not(.title) {
|
||||
box-shadow: 0 1px 0;
|
||||
}
|
||||
|
||||
.paginav .next {
|
||||
margin-inline-start: auto;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
[dir="rtl"] .paginav .next {
|
||||
text-align: left;
|
||||
}
|
||||
|
@ -57,6 +57,27 @@
|
||||
{{- end }}
|
||||
</ul>
|
||||
{{- end }}
|
||||
{{- if .Site.Params.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 }}
|
||||
{{- end }}
|
||||
{{- if (and .Site.Params.ShowShareButtons (ne .Params.disableShare true) ) }}
|
||||
{{- partial "share_icons.html" . }}
|
||||
{{- end }}
|
||||
|
Loading…
Reference in New Issue
Block a user