Shopify themes, liquid, logos, and UX
Hello,
I'm building an ingredients page that has the alphabet at the top as tabs and the content for each letter underneath.
I've set up block types to manage this, ie:
<div id="tabs">
<ul>
<li><a href="#A">A</a></li>
<li><a href="#B">B</a></li>
<li><a href="#C">C</a></li>
</ul>
<div id="A">
{% for block in section.blocks %}
{% if block.type == 'A' %}
{% include 'ingredientItem' %}
{% endif %}
{% endfor %}
</div>
<div id="B">
{% for block in section.blocks %}
{% if block.type == 'A' %}
{% include 'ingredientItem' %}
{% endif %}
{% endfor %}
</div>
<div id="C">
{% for block in section.blocks %}
{% if block.type == 'A' %}
{% include 'ingredientItem' %}
{% endif %}
{% endfor %}
</div>
</div>
What I would like to do is to check if there has been a block type created and only apply my link to the letter in the list if that block type exists.
eg:
<div id="tabs">
<ul>
<li>{% if block.type == A%}<a href="#A">A</a>{% else %}<span class="inactive">A</span>{% endif %}</li>
</ul>
<div id="A">
{% for block in section.blocks %}
{% if block.type == 'A' %}
{% include 'ingredientItem' %}
{% endif %}
{% endfor %}
</div>
</div>
But obviously, what I have here doesn't work. I was looking for some help as to how to check for a block type's existence.
Thanks for any help you can provide.
sorry for this issue can you please try maybe helpful this
http://www.codeshopify.com/blog_posts/shopify-sections-with-dynamic-blocks
Are you ready to take your business to the next level? Look no further than the latest ...
By SarahF_Shopify Apr 15, 2024We’re keeping the ball rolling to make sure you’re always ahead of the game. So buckle ...
By JasonH Apr 8, 2024Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024