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

Error calling Parent Resources after saving in server mode with 0.55 #5833

Closed
karamme opened this issue Apr 9, 2019 · 7 comments · Fixed by #5871
Closed

Error calling Parent Resources after saving in server mode with 0.55 #5833

karamme opened this issue Apr 9, 2019 · 7 comments · Fixed by #5871
Assignees
Milestone

Comments

@karamme
Copy link

karamme commented Apr 9, 2019

To narrow it down: I have a shortcode image with content:

{{ .Page.Parent.Resources }}

When I start the server mode, everything works fine. If I edit and save the content file which calls this shortcode I get the error:

execute of template failed: template: shortcodes/image.html:1:8: executing "shortcodes/image.html" at <.Page.Parent.Resources>: error calling Resources: runtime

error: invalid memory address or nil pointer dereference

After restarting server mode, it works fine until I save. Also, if I save another file while not exiting the server mode, it rebuilds without throwing an error.

I am running 0.55.0 extended version on windows 10.

@bep bep added this to the v0.55.1 milestone Apr 9, 2019
@bep
Copy link
Member

bep commented Apr 9, 2019

I assume this did work in 0.54?

@karamme
Copy link
Author

karamme commented Apr 9, 2019

Yes, it worked fine in 0.54. I tried both hugo server and hugo server --disableFastRender.

@bep
Copy link
Member

bep commented Apr 12, 2019

I have added some tests for this, but I cannot reproduce it. Do you have the failing site's source available online?

@bep bep modified the milestones: v0.55.1, v0.56 Apr 12, 2019
@karamme
Copy link
Author

karamme commented Apr 12, 2019

the original repo is on a self-hosted university gitlab. So I just made a copy and removed all the unnecessary files. I send you an invite.

I started a new site from scratch and couldn't reproduce the error either. So maybe it is related to multilangual issues or something. shortcode name is test with content {{ .Page.Parent.Resources }}

How to reproduce with the shared repo:

  • start server (no failure)
  • edit sandbox.de.md (failure)

Error message:

ERROR 2019/04/12 13:30:52 "C:\work\parentresource\content\sandbox.de.md:7:1": failed to render shortcode "test": failed to process shortcode: "C:\work\parentresource\layouts\shortcodes\test.html:1:8": execute of template failed: template: shortcodes/test.html:1:8: executing "shortcodes/test.html" at <.Page.Parent.Resources>: error calling Resources: runtime error: invalid memory address or nil pointer dereference

Thanks for having a look at this.

@bep
Copy link
Member

bep commented Apr 12, 2019

I send you an invite.

Can you post a link here. This is an open source project. Someone else may look into this issue before I get to it.

@karamme
Copy link
Author

karamme commented Apr 15, 2019

Alright. I tried to pin the error down. Here is a link to a very simplified repo. What I figured out was, that it is not totally related to the .Parent.Resources but to the Output Formats and maybe to issue #5800. The config states:

[outputs]
home = ["HTML", "RSS", "REDIRECTS"]

[outputFormats.REDIRECTS]
[...]

Reproduction of the error is the same as two posts above, only now my test page is called test.md. If I only have two output formats, it works, if there is more (I tried cutom made redirects and sitemap) the error shows. If I use either html and rss or html and redirects, it works fine.

If I use all three and provide a rss template (which I copied from the docs) but remove <description>{{ .Summary | html }}</description> it works as well. So maybe this has to do with #5800. I tried to provide a frontmatter summary, an html tag and to place my shortcode far away from the beginning (so it is not part of the automatic summary) but neither solved the error with the invalid .Parent.Resources.

I hope this provides enough information to tackle the issue

EDIT: Maybe it has the same root as #5858 and will be fixed by #5862

@bep bep modified the milestones: v0.56, v0.55.2 Apr 15, 2019
@bep bep self-assigned this Apr 15, 2019
bep added a commit to bep/hugo that referenced this issue Apr 17, 2019
Which had some unpredictable behaviour when using `.Pages` on home page etc. that had a content page.

Fixes gohugoio#5833
bep added a commit to bep/hugo that referenced this issue Apr 17, 2019
Which had some unpredictable behaviour when using `.Pages` on home page etc. that had a content page.

Fixes gohugoio#5833
@bep bep closed this as completed in #5871 Apr 17, 2019
bep added a commit that referenced this issue Apr 17, 2019
Which had some unpredictable behaviour when using `.Pages` on home page etc. that had a content page.

Fixes #5833
@github-actions
Copy link

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 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants