I am trying to check for the existence of a text field and an asset field and set an icon variable depending on the result. I don't seem to be having much luck with defined, length and empty combinations.
Here's my code so far:
{% if (story.videoStoryUrl is defined) and (not story.storyImage | length) %}
{% set icon = "video" %}
{% elseif (story.videoStoryUrl is empty) and (not story.storyImage | length) %}
{% set icon = "text" %}
{% else %}
{% set icon = "image" %}
{% endif %}
Any help appreciated :)