Last active
November 9, 2020 16:38
-
-
Save kyleaparker/b108e7142be8ee105f8b to your computer and use it in GitHub Desktop.
Alphabetical vendor categorization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul> | |
{% assign current = "" %} | |
{% for product_vendor in shop.vendors %} | |
{% assign first_letter = product_vendor | strip_html | upcase | truncate: 1, '' %} | |
{% unless first_letter == current %} | |
<li class="vendor-letter">{{ first_letter }}</li> | |
{% endunless %} | |
<li>{{ product_vendor | link_to_vendor }}</li> | |
{% assign current = first_letter %} | |
{% endfor %} | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment