Fix pagination on writeups

alternate-navbar
Maik de Kruif 2 years ago
parent d6544b95cf
commit 7178e45413
Signed by: maik
GPG Key ID: 44A55AD1F0673FA6
  1. 0
      .hugo_build.lock
  2. 1
      themes/maik-blog/layouts/_default/baseof.html
  3. 9
      themes/maik-blog/layouts/partials/seo.html
  4. 11
      themes/maik-blog/layouts/writeups/list.html

@ -1,3 +1,4 @@
{{- $paginator := .Paginate .RegularPagesRecursive }}
<!DOCTYPE html>
<html lang="{{ .Site.Language }}">

@ -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,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>

Loading…
Cancel
Save