CaiJimmy / hugo-theme-stack

Card-style Hugo theme designed for bloggers
https://stack.jimmycai.com
GNU General Public License v3.0
4.85k stars 1.58k forks source link

页面标题未按预期生成 #941

Closed StrMnL closed 7 months ago

StrMnL commented 7 months ago

What happened?

按照layouts/partials/data/title.html中所写

{{- if .IsHome -}}

    ....

    {{ if .Paginator.HasPrev }}
        {{ $title = printf "%s - %s" .Paginator $siteTitle }}
    {{ else }}
        {{ $title = $siteTitle}}
    {{ end }}
{{- else if eq .Kind "term" -}}

    ....

    {{ if .Paginator.HasPrev }}
        {{ $title = $title | append " - " .Paginator }}
    {{ end }} 

    ....

{{- end -}}

在存在分页的情况下,home页第二页起的页面标题应该形如Pager 2 - Hugo Theme Stack Starter

term页第二页起的页面标题应该形如Tag: Test - Pager 2 - Hugo Theme Stack Starter

但实际上这并不起作用。无论如何.Paginator.HasPrev恒为false。

Hugo version

0.122.0

Theme version

3.21.0

What browsers are you seeing the problem on?

No response

More information about the browser

No response

Relevant log output

No response

Link to Minimal Reproducible Example

https://github.com/StrMnL/hugo-theme-stack-test/

CaiJimmy commented 7 months ago

Should be fixed now. Thanks for reporting this!