New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.Site.Params regression #5094

Closed
olOwOlo opened this Issue Aug 18, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@olOwOlo

olOwOlo commented Aug 18, 2018

Hi there, I've just upgraded to Hugo v0.47, but ...

PS E:\C\blog\hugo\olowolo> hugo version
Hugo Static Site Generator v0.46 windows/amd64 BuildDate: 2018-08-01T09:01:27Z
PS E:\C\blog\hugo\olowolo> hugo
Building sites …
                   | ZH-CN
+------------------+-------+
  Pages            |    87
  Paginator pages  |     1
  Non-page files   |     0
  Static files     |    66
  Processed images |     0
  Aliases          |    15
  Sitemaps         |     1
  Cleaned          |     0

Total in 854 ms
PS E:\C\blog\hugo\olowolo> hugo version
Hugo Static Site Generator v0.47 windows/amd64 BuildDate: 2018-08-17T09:15:51Z
PS E:\C\blog\hugo\olowolo> hugo
Building sites … ERROR 2018/08/18 13:12:34 Error while rendering "taxonomy" in "": template: _default\taxonomy.html:6:22: executing "content" a
t <$paginator.hasprev>: can't evaluate field hasprev in type *hugolib.Pager

taxonomy.html

{{- define "title" }}{{ .Title }} · {{ .Site.Title }}{{ end -}}

{{- define "content" }}
{{- $paginator := .Paginate .Data.Pages.ByDate.Reverse .Site.Params.archivePaginate -}}
<section id="archive" class="archive">
  {{ if not $paginator.HasPrev -}}

What happened to HasPrev? A breaking change? 😳

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Aug 18, 2018

Member

What did you upgrade from? The $paginator is nil for some reason. A hunch: Can you try to remote .Site.Params.archivePaginate and see if that helps (or use .Site.Params.archivepaginate.

Member

bep commented Aug 18, 2018

What did you upgrade from? The $paginator is nil for some reason. A hunch: Can you try to remote .Site.Params.archivePaginate and see if that helps (or use .Site.Params.archivepaginate.

@olOwOlo

This comment has been minimized.

Show comment
Hide comment
@olOwOlo

olOwOlo Aug 18, 2018

I tried all of the following code, but they all got the same error (However, 0.46 works well).

{{- $paginator := .Paginate .Data.Pages.ByDate.Reverse .Site.Params.archivepaginate -}}
{{- $paginator := .Paginate .Data.Pages.ByDate.Reverse 5 -}}
{{- $paginator := .Paginate .Data.Pages.ByDate.Reverse -}}

checksum

snipaste_20180818_175515


Maybe you can reproduce by this theme, there is a related issue olOwOlo/hugo-theme-even#88

olOwOlo commented Aug 18, 2018

I tried all of the following code, but they all got the same error (However, 0.46 works well).

{{- $paginator := .Paginate .Data.Pages.ByDate.Reverse .Site.Params.archivepaginate -}}
{{- $paginator := .Paginate .Data.Pages.ByDate.Reverse 5 -}}
{{- $paginator := .Paginate .Data.Pages.ByDate.Reverse -}}

checksum

snipaste_20180818_175515


Maybe you can reproduce by this theme, there is a related issue olOwOlo/hugo-theme-even#88

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Aug 18, 2018

Member

It works if you do

{{ $count := .Site.Params.archivePaginate }}
{{- $paginator := .Paginate .Data.Pages.ByDate.Reverse $count }}

(in both the relevant templates).

But this is a bug, alright.

Member

bep commented Aug 18, 2018

It works if you do

{{ $count := .Site.Params.archivePaginate }}
{{- $paginator := .Paginate .Data.Pages.ByDate.Reverse $count }}

(in both the relevant templates).

But this is a bug, alright.

@bep bep added the Bug label Aug 18, 2018

@bep bep self-assigned this Aug 18, 2018

@bep bep added this to the v0.47.1 milestone Aug 18, 2018

@bep bep changed the title from "can't evaluate field hasprev in type *hugolib.Pager" in 0.47 to .Site.Params regression Aug 18, 2018

bep added a commit to bep/hugo that referenced this issue Aug 19, 2018

@bep bep closed this in #5097 Aug 19, 2018

bep added a commit that referenced this issue Aug 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment