Skip to content
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

nil pointer evaluating page.Page.IsHome on "blog only" site #1115

Closed
E-G-C opened this issue Jul 26, 2022 · 5 comments · Fixed by #1121
Closed

nil pointer evaluating page.Page.IsHome on "blog only" site #1115

E-G-C opened this issue Jul 26, 2022 · 5 comments · Fixed by #1121
Assignees
Labels
bug Something isn't working e0-minutes Effort < 60 min

Comments

@E-G-C
Copy link

E-G-C commented Jul 26, 2022

Similar to #804, when a site is set to "blog only" we get the error:

failed to render pages: render of "home" failed: 
..../modules/pkg/mod/github.com/google/[email protected]/layouts/blog/list.html:2:13": execute of template failed at <.Parent.IsHome>: nil pointer evaluating page.Page.IsHome 

steps to reproduce:

---
tittle: "Some index"
linkTitle: "my index"
date: 2022-07-25
cascade:
  - type: "blog"

---
index content
  • launch hugo server if you have not
  • open localhost:1313 in your browser
  • check for the error mentioned above
 failed to render pages: render of "home" failed: "/var/folders/4d/k9zf9mfx2bj1z46bsmh4zr4h0000gn/T/hugo_cache/modules/filecache/modules/pkg/mod/github.com/google/[email protected]/layouts/blog/list.html:2:13": execute of template failed at <.Parent.IsHome>: nil pointer evaluating page.Page.IsHome 
/var/folders/4d/k9zf9mfx2bj1z46bsmh4zr4h0000gn/T/hugo_cache/modules/filecache/modules/pkg/mod/github.com/google/[email protected]/layouts/blog/list.html:2:13:
{{ define "main" }}
{{ if .Parent.IsHome }}
{{ $.Scratch.Set "blog-pages" (where .Site.RegularPages "Section" .Section) }}
{{ else }}
hugo v0.100.2+extended darwin/arm64 BuildDate=unknown
@E-G-C E-G-C changed the title nil pointer evaluating page.Page.IsHome on blog only site nil pointer evaluating page.Page.IsHome on "blog only" site Jul 26, 2022
@chalin
Copy link
Collaborator

chalin commented Jul 26, 2022

Thanks for the clean and simple repro @E-G-C!

@chalin chalin self-assigned this Jul 26, 2022
@chalin chalin added bug Something isn't working e0-minutes Effort < 60 min labels Jul 26, 2022
@chalin
Copy link
Collaborator

chalin commented Jul 26, 2022

Fixed. Can you give it a try @E-G-C?

@E-G-C
Copy link
Author

E-G-C commented Jul 26, 2022

yes, the error is gone, got some warnings though

WARNING: calling IsSet with unsupported type "invalid" (<nil>) will always return false.

@chalin
Copy link
Collaborator

chalin commented Jul 27, 2022

@E-G-C, thanks for the feedback. Do you have a repro, or can you share a link to your repo?

@chalin
Copy link
Collaborator

chalin commented Aug 15, 2022

@E-G-C - feel free to reopen this issue if you'd like the warning addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working e0-minutes Effort < 60 min
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants