Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save zakhardage/6170403 to your computer and use it in GitHub Desktop.
Save zakhardage/6170403 to your computer and use it in GitHub Desktop.
This particular snippet is used to display the about-the-maker tabbed content on koromiko.com's product pages.
{% for article in blogs.retailers.articles reversed %}
{% assign content = article.content | strip_html | split:',' %}
{% assign state = content[1] %}
{% unless states contains state %}
{% assign count = count | plus:1 %}
{% assign stores = 0 %}
{% capture states %}{{ state }} {{ states }}{% endcapture %}
<h3 class="state">{{ state }}</h3>
<p>
<script>
var stores{{ count }} = new Array();
{% for article in blogs.retailers.articles %}
{% if article.content contains state %}
{% assign sub-content = article.content | strip_html | split:',' %}
stores{{ count }}[{{ stores }}] = "{{ sub-content[0] }}, {{ article.title }}<br />";
{% assign stores = stores | plus:1 %}
{% endif %}
{% endfor %}
stores{{ count }}.sort();
for(var i=0;i<{{ stores }};i++) {
document.write(stores{{ count }}[i]);
}
</script>
</p>
{% endunless %}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment