Skip to content
New issue

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

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

Already on GitHub? # to your account

Invoking .Page.RenderString on a page without a backing file throws an erroneous warning #9433

Closed
jmooring opened this issue Jan 27, 2022 · 3 comments · Fixed by #9438
Closed
Assignees
Milestone

Comments

@jmooring
Copy link
Member

jmooring commented Jan 27, 2022

This was introduced in v0.92.0, and is still present in v0.92.1.

MRE:

git clone --single-branch -b hugo-github-issue-9433 https://github.com/jmooring/hugo-testing hugo-github-issue-9433
cd hugo-github-issue-9433
hugo 

.File.Path on zero object. Wrap it in if or with: {{ with .File }}{{ .Path }}{{ end }}

The warning is triggered in layouts/_default/list.html, line 4:

{{ .RenderString "foo" }}

References:

@bep bep removed the NeedsTriage label Jan 28, 2022
@bep bep self-assigned this Jan 28, 2022
@bep bep added this to the v0.92.2 milestone Jan 28, 2022
@bep
Copy link
Member

bep commented Jan 28, 2022

Thanks ... We should have made that an error long time ago, but I guess we cannot do that in a patch release ...

@jmooring
Copy link
Member Author

We should have made that an error

Please clarify. Should I update the documentation to indicate that this method should not be used on pages that are not backed by file?

@github-actions
Copy link

github-actions bot commented Feb 5, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 5, 2022
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants