-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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: unable to cast <nil> since hugo v0.87 #8865
Comments
Not sure if this is a bug or not, but first you should just be able to do something like:
Second, if you'd like to cleanup your code a bit you can include all your comments into a single comment:
|
@braderhart Thanks for your input. I adjusted the code to
but I still get the error
|
I'm not sure how the above could have changed in the latest release, but we should handle nil inputs, so I will fix that. That said, the reason @braderhart 's suggestion does not work is that and/or in Go templates does not short circuit (this will be fixed in Go 1.17). |
I have reverted the above "fix" after thinking about it:
|
Then how can I adjust the code to avoid |
@AndreasAZiegler Please show an example of event frontmatter. |
Below an example of
|
There may be a more concise way to do this...
|
More concise...
|
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. |
What version of Hugo are you using (
hugo version
)?Does this issue reproduce with the latest release?
Yes
Since hugo v0.87.0 we get the error
for this part of the code
The text was updated successfully, but these errors were encountered: