Fix pagination on writeups

This commit is contained in:
2021-11-30 23:18:43 +01:00
parent d6544b95cf
commit 7178e45413
4 changed files with 6 additions and 15 deletions
@@ -1,3 +1,4 @@
{{- $paginator := .Paginate .RegularPagesRecursive }}
<!DOCTYPE html>
<html lang="{{ .Site.Language }}">
+4 -5
View File
@@ -210,16 +210,15 @@
{{- end }}
{{- end }}
"description": {{ .Params.description | plainify }}
}{{ end }}{{ if .IsSection }},
}{{ end }}{{ if or .IsSection (or (eq .Kind "term") (eq .Kind "taxonomy")) }},
{
"@context": "http://schema.org",
"@type": "ItemList",
"itemListOrder": "https://schema.org/ItemListOrderDescending",
"name": "{{ .Title }}",
"numberOfItems": {{ len .Data.Pages }},
"numberOfItems": {{ .Paginator.TotalNumberOfElements }},
"itemListElement": [
{{- $pages := first 10 .Data.Pages }}
{{- range $index, $page := $pages }}
{{- range $index, $page := .Paginator.Pages }}
{
"@type": "ListItem",
"position": {{ add $index 1 }},
@@ -283,7 +282,7 @@
{{- end }}
"description": {{ .Params.description | plainify }}
}
}{{ if ne (sub (len $pages) 1) $index }},{{ end }}
}{{ if ne $index (sub $.Paginator.NumberOfElements 1) }},{{ end }}
{{- end }}
]
}{{ end }}
+1 -10
View File
@@ -1,14 +1,5 @@
{{ define "main" }}
{{- $allWriteups := slice }}
{{- range where (where .Site.Pages "Section" .Section) "IsPage" true }}
{{- if $.IsAncestor . }}
{{- $allWriteups = $allWriteups | append . }}
{{- end }}
{{- end }}
{{- $allWriteups = sort $allWriteups "Date" "desc" }}
{{ $paginator := .Paginate $allWriteups }}
<main class="posts">
<h1>{{ .Title }}</h1>
@@ -21,7 +12,7 @@
{{- end }}
<div class="posts-list masonry">
{{ range $paginator.Pages }}
{{ range .Paginator.Pages }}
<div class="post masonry-item">
<div class="masonry-item-content">
<h2 class="post-title"><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h2>