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
kascme opened this issue Apr 9, 2019 · 6 comments

Comments

Projects
None yet
2 participants
@kascme
Copy link

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

This comment has been minimized.

Copy link
Member

commented Apr 9, 2019

I assume this did work in 0.54?

@kascme

This comment has been minimized.

Copy link
Author

commented Apr 9, 2019

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

bep added a commit that referenced this issue Apr 12, 2019

@bep

This comment has been minimized.

Copy link
Member

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

@kascme

This comment has been minimized.

Copy link
Author

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

This comment has been minimized.

Copy link
Member

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.

@kascme

This comment has been minimized.

Copy link
Author

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

hugolib: Fix Pages reinitialization on rebuilds
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

hugolib: Fix Pages reinitialization on rebuilds
Which had some unpredictable behaviour when using `.Pages` on home page etc. that had a content page.

Fixes gohugoio#5833

@bep bep closed this in #5871 Apr 17, 2019

bep added a commit that referenced this issue Apr 17, 2019

hugolib: Fix Pages reinitialization on rebuilds
Which had some unpredictable behaviour when using `.Pages` on home page etc. that had a content page.

Fixes #5833
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.