Add article pagination links and display params

This commit is contained in:
James Panther
2021-08-14 14:44:34 +10:00
parent 074b1ff11d
commit c24b8ab2e1
9 changed files with 114 additions and 40 deletions
+45
View File
@@ -0,0 +1,45 @@
{{ if .Site.Params.article.showPagination | default true }}
{{ if or .NextInSection .PrevInSection }}
<div class="pt-8">
<hr class="border-gray-300 border-dotted dark:border-gray-600" />
<div class="flex justify-between pt-3">
<span>
{{ if .NextInSection }}
<a class="flex" href="{{ .NextInSection.Permalink }}">
<span class="mr-3"></span>
<span class="flex flex-col">
<span class="button__text">{{ .NextInSection.Title }}</span>
{{ if .Site.Params.article.showDate | default true }}
<time
class="-mt-1 text-xs text-gray-400 dark:text-gray-500"
datetime="{{ .Date }}"
>
{{ .Date.Format .Site.Params.article.dateFormat | default "2 January 2006" }}
</time>
{{ end }}
</span>
</a>
{{ end }}
</span>
<span>
{{ if .PrevInSection }}
<a class="flex text-right" href="{{ .PrevInSection.Permalink }}">
<span class="flex flex-col">
<span>{{ .PrevInSection.Title }}</span>
{{ if .Site.Params.article.showDate | default true }}
<time
class="-mt-1 text-xs text-gray-400 dark:text-gray-500"
datetime="{{ .Date }}"
>
{{ .Date.Format .Site.Params.article.dateFormat | default "2 January 2006" }}
</time>
{{ end }}
</span>
<span class="ml-3"></span>
</a>
{{ end }}
</span>
</div>
</div>
{{ end }}
{{ end }}