Hi,
I have an if/else statement that checks if a file metafield has a value in it, and if it’s empty, it should use a specific GID that I’m putting directly in the liquid code block.
The desired purpose is to display a backup image when the object doesn’t have an image selected.
The problem I have is that while the GID outputs correctly as a text string in a paragraph block, when I’m using it as an image source, it generates an error message. How do I need to format this GID string so that it will work?
{% for item in shop.metaobjects.bike_guide.values %}
{% if item.brand.value.brand != blank %}
{% if item.top_image != blank %}
{% assign card_image = item.top_image %}
{% else %}
**{% assign card_image = 'gid://shopify/MediaImage/62419296813284' %}**
{% endif %}
<a href="{{item.metaobject_system.url}}" style="text-decoration: none;">
<div class="repeater-card">
<div class="repeater-image-container">
**<img src="{{ card_image | image_url }}**" alt="{{item.title}}" loading="lazy">
</div>
<h4>{{ item.title }}</h4>
<p>{{ item.intro_title }}</p>
</div>
</a>
{% endif %}
{% endfor %}