You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
which causes a failure upon running hugo serve --bind=0.0.0.0 --watch:
Error: error building site: render: failed to render pages: render of "/" failed: "themes/my-theme/layouts/_default/home.html:10:7": execute of template failed: template: _default/home.html:10:7: executing "main" at <partial "features/core" .>: error calling partial: "/themes/my-theme/layouts/partials/features/core.html:31:46": execute of template failed: template: partials/features/core.html:31:46: executing "partials/features/core.html" at <$feature.title>: can't evaluate field title in type interface {}
However, the same data and template with the flag set to true works as expected. I have also attempted to use:
{{ range $index, $feature := where $data.features "paid" "eq" false }}
{{ range $index, $feature := where $data.features "paid" "ne" true }}
all with the same result. The only method that I have found works is:
{{ range $index, $feature := where $data.features "paid" "eq" "false" }}
which is less than ideal, as it forces me to change the data types and use a string rather than a bool value for the paid and other bool type fields.
Additional notes:
It's a janky workaround and wouldn't work using build, but if I modify the partial to true on the launch of serve command, then modify the partial to false after the service is available, the template continues to compile and works as expected.
The text was updated successfully, but these errors were encountered:
The where condition isn't the problem. This example uses your code (see layouts/_default/home.html) and your data:
git clone --single-branch -b hugo-github-issue-13207 https://github.com/jmooring/hugo-testing hugo-github-issue-13207
cd hugo-github-issue-13207
hugo server
Works great. You have a different problem.
Please create a new topic on the forum where we handle questions and troubleshooting. Thanks.
Thanks for the example repo, it helped me identify the issue. It was being caused by a malformed structure in my fr data file; the english file was in the correctly structure.
What version of Hugo are you using (
hugo version
)?The issue also existed in 1.4.0.
Does this issue reproduce with the latest release?
Yes.
Issue
Boolean Comparison in collection comparison causes the build/serve command to fail.
I have a data folder containing a structure like:
Within my theme I have a partial that contains:
which causes a failure upon running
hugo serve --bind=0.0.0.0 --watch
:However, the same data and template with the flag set to
true
works as expected. I have also attempted to use:all with the same result. The only method that I have found works is:
which is less than ideal, as it forces me to change the data types and use a
string
rather than abool
value for thepaid
and otherbool
type fields.Additional notes:
It's a janky workaround and wouldn't work using
build
, but if I modify the partial totrue
on the launch ofserve
command, then modify the partial tofalse
after the service is available, the template continues to compile and works as expected.The text was updated successfully, but these errors were encountered: