if statement - Liquid Hide Featured image and show placeholder
Solution:
One thing that jumps out at me is 'featured-image'. Usually schema ID's will use underscores, not hyphens. It might help to post that part of your schema code to see if there's anything wrong there.
Checking the CLI for any errors might help as well (if you're using the CLI).
Another thing you could do is use an{% else %}
tag, instead of two IF tags, which will clean things up a bit.
{% if featured-image != blank %}
<div>
<img src="{{ article | img_url: 'master' }}" loading="lazy" alt="{{ article.alt }}" class="featured_image">
</div>
{% else %}
<div class="placeholder_image"></div>
{% endif %}
Answer
Solution:
As mentioned earlier by @ComicsDansMS, this was the mistake. And also it should look like this:{% if article.image != blank %}
Source
Didn't find the answer?
Our community is visited by hundreds of Shopify development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.