how to avoid template errors, if key does not exist #4779
-
|
If I was searching for hours how I can check if the key exits or make Instead of throwing an error, I rather want the block not to run, when the key does not exist. |
Beta Was this translation helpful? Give feedback.
Answered by
halostatue
Nov 25, 2025
Replies: 1 comment 2 replies
-
|
Use the |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
twpayne
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use the
getfunction. It's documented as part of the sprig functions and I think it'sget "key" ., but I'm not really sure offhand.