fix: title does not show pagination data (#945)

* fix: title does not show pagination data

This is caused by partialCached. It turns out that the `.RelPermalink` is the same for all pages generated by the paginator, so they will show the same title as the first page.

closes https://github.com/CaiJimmy/hugo-theme-stack/issues/941

* doc(exampleSite): set paginate to 3 to force pagination
This commit is contained in:
Jimmy Cai 2024-02-19 10:54:02 +01:00 committed by GitHub
parent 21da06e448
commit 03ee3369e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -1,7 +1,7 @@
baseurl: https://example.com baseurl: https://example.com
languageCode: en-us languageCode: en-us
theme: hugo-theme-stack theme: hugo-theme-stack
paginate: 5 paginate: 3
title: Example Site title: Example Site
copyright: Example Person copyright: Example Person

View File

@ -5,7 +5,7 @@
<meta name='description' content='{{ $description }}'> <meta name='description' content='{{ $description }}'>
{{ with .Params.Keywords }}<meta name="keywords" content="{{ delimit . ", " }}">{{ end }} {{ with .Params.Keywords }}<meta name="keywords" content="{{ delimit . ", " }}">{{ end }}
{{- $title := partialCached "data/title" . .RelPermalink -}} {{- $title := partial "data/title" . -}}
<title>{{ $title }}</title> <title>{{ $title }}</title>
<link rel='canonical' href='{{ .Permalink }}'> <link rel='canonical' href='{{ .Permalink }}'>