Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

[BUG] Render of "page" failed #262

Closed
KHannibal opened this issue Aug 12, 2021 · 7 comments
Closed

[BUG] Render of "page" failed #262

KHannibal opened this issue Aug 12, 2021 · 7 comments
Labels
bug Something isn't working

Comments

@KHannibal
Copy link

Describe the bug

When running the command hugo to build my websites, several errors appeared.

ERROR 2021/08/12 07:37:53 render of "page" failed: execute of template failed: template: posts/single.html:107:12: executing "content" at <partial "single/footer.html" .>: error calling partial: "/Sites/blog/themes/CodeIT/layouts/partials/single/footer.html:54:32": execute of template failed: template: partials/single/footer.html:54:32: executing "partials/single/footer.html" at <partialCached "function/path.html" $value $value>: error calling partialCached: partial that returns a value needs a non-zero argument.

ERROR 2021/08/12 07:37:53 render of "page" failed: execute of template failed: template: posts/single.html:107:12: executing "content" at <partial "single/footer.html" .>: error calling partial: "/Sites/blog/themes/CodeIT/layouts/partials/single/footer.html:54:32": execute of template failed: template: partials/single/footer.html:54:32: executing "partials/single/footer.html" at <partialCached "function/path.html" $value $value>: error calling partialCached: partial that returns a value needs a non-zero argument.

ERROR 2021/08/12 07:37:53 render of "home" failed: execute of template failed: template: index.html:36:20: executing "content" at <.Render>: error calling Render: "/Sites/blog/content/posts/2016/test.md:69:32": failed to execute template ["summary"] v: "/Sites/blog/themes/CodeIT/layouts/_default/summary.html:69:32": execute of template failed: template: _default/summary.html:69:32: executing "_default/summary.html" at <partialCached "function/path.html" $value $value>: error calling partialCached: partial that returns a value needs a non-zero argument.

Error: Error building site: failed to render pages: render of "page" failed: execute of template failed: template: posts/single.html:107:12: executing "content" at <partial "single/footer.html" .>: error calling partial: "/Sites/blog/themes/CodeIT/layouts/partials/single/footer.html:54:32": execute of template failed: template: partials/single/footer.html:54:32: executing "partials/single/footer.html" at <partialCached "function/path.html" $value $value>: error calling partialCached: partial that returns a value needs a non-zero argument.

What I did to fix the issue was to remove one $value in /layouts/_default/summary.html, at 69:32 in order to get
{{- $tag := partialCached "function/path.html" $value | printf "/tags/%v" | $.Site.GetPage -}} instead of
{{- $tag := partialCached "function/path.html" $value $value | printf "/tags/%v" | $.Site.GetPage -}}

I did the same in /layouts/partials/single/footer.html at 54:32.

Now my website builds properly.

Build Environment

  • OS: macOS
  • Theme version/commit : 0.2.0
  • Hugo version : hugo v0.87.0+extended darwin/arm64

Additional Information

Could my fix be the cause of this issue #212 ?

@KHannibal KHannibal added the bug Something isn't working label Aug 12, 2021
@victor-pogor
Copy link
Member

Hi @KHannibal,

Can you send me the repository link to your blog?

@KHannibal
Copy link
Author

Hi @victor-pogor,

You mean, you would like a copy of my website repository ?

@victor-pogor
Copy link
Member

@KHannibal I just wanted to look in your blog repository to try to identify the root cause of this issue, but If your blog's source code is closed, it's ok, I'll try to find out without it. :)

@KHannibal
Copy link
Author

No problem @victor-pogor, I will send you that by email. Some data such as ID and other sensitive materials will be removed, obviously. ;) Thanks in advance !

@KHannibal
Copy link
Author

@victor-pogor repository sent. Thanks a lot !

@victor-pogor
Copy link
Member

Hi @KHannibal,

I was able to reproduce your issue. I analyzed your repository and the theme's code and I observed that the error persists when you have the tags with the empty content. So you have to remove all empty tags from your posts.

Scenario Result
tags: [""]
tags: [] ✔️
tags: ["abc"] ✔️

@KHannibal
Copy link
Author

Wow, I did not even notice that. Thanks a lot !!! 👍
And you killed two birds with one stone, since you simultaneously fixed the #212 issue. Let me know how I can offer you a coffee. :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants