A couple fixes for page navigation

- Put the previous post on the left, and the next post on the right
- Simplify the CSS class names and styles
This commit is contained in:
Eryn Wells 2024-12-23 08:13:30 -08:00
parent 1eba82c96b
commit accd1aceeb
2 changed files with 9 additions and 9 deletions

View file

@ -15,27 +15,27 @@
justify-content: flex-end; justify-content: flex-end;
} }
li { .prev, .next {
display: block; display: block;
padding-inline: 0; padding-inline: 0;
} }
.next-page { .next {
text-align: right; text-align: right;
} }
.previous-page::before, .prev::before,
.next-page::after { .next::after {
color: var(--text-color-secondary); color: var(--text-color-secondary);
font-family: var(--font-family-monospace); font-family: var(--font-family-monospace);
} }
.previous-page::before { .prev::before {
content: "<-"; content: "<-";
padding-inline-end: var(--space-s); padding-inline-end: var(--space-s);
} }
.next-page::after { .next::after {
content: "->"; content: "->";
padding-inline-start: var(--space-s); padding-inline-start: var(--space-s);
} }

View file

@ -1,18 +1,18 @@
{{ if .FirstSection }} {{ if .FirstSection }}
{{- $pages := where .FirstSection.RegularPagesRecursive "Draft" "eq" false -}} {{- $pages := (where .FirstSection.RegularPagesRecursive "Draft" "eq" false).ByDate -}}
{{- $previousInSection := $pages.Prev . -}} {{- $previousInSection := $pages.Prev . -}}
{{- $nextInSection := $pages.Next . -}} {{- $nextInSection := $pages.Next . -}}
{{ if or $previousInSection $nextInSection }} {{ if or $previousInSection $nextInSection }}
<ul class="page-navigation"> <ul class="page-navigation">
{{ with $nextInSection -}} {{ with $nextInSection -}}
<li class="previous-page"> <li class="prev">
<a href="{{ .Permalink }}">{{ .LinkTitle | markdownify }}</a> <a href="{{ .Permalink }}">{{ .LinkTitle | markdownify }}</a>
</li> </li>
{{- end }} {{- end }}
{{ with $previousInSection -}} {{ with $previousInSection -}}
<li class="next-page"> <li class="next">
<a href="{{ .Permalink }}">{{ .LinkTitle | markdownify }}</a> <a href="{{ .Permalink }}">{{ .LinkTitle | markdownify }}</a>
</li> </li>
{{- end }} {{- end }}