Skip to content

Commit

Permalink
Fixes paginator issue since hugo v0.123.0
Browse files Browse the repository at this point in the history
Pages of kind "page" don't allow the creation of a paginator (.Paginate
or .Paginator) in the newest version of hugo.
Pages of kind "section" (e.g. /posts) still allow the creation. This fix
adds a check for the kind of page and excludes pages with kind "page"
from creating a paginator.
  • Loading branch information
MichielVanDerWinden authored and hugo-sid committed Mar 7, 2024
1 parent 967ccb5 commit 10aff14
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions layouts/partials/meta/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{{ if eq .Section "posts" }}
{{ $ISO_date := dateFormat "2006-01-02T15:04:05Z0700" .Date | safeHTML }}
<!-- Pagination meta tags for list pages only -->
{{ if ne .Page.Kind "page" }}
{{ $paginator := .Paginate (where .Pages "Section" "blog") }}
{{ if $paginator }}
<link rel="first" href="{{ $paginator.First.URL }}" />
Expand All @@ -13,6 +14,7 @@
<link rel="next" href="{{ $paginator.Next.URL }}" />
{{end }}
{{end }}
{{end }}

<meta property="og:type" content="article" />
<meta property="og:article:published_time" content={{ $ISO_date | safeHTML }} />
Expand Down

0 comments on commit 10aff14

Please sign in to comment.