Skip to content

Instantly share code, notes, and snippets.

@ed-codes
Created March 20, 2016 07:13
Show Gist options
  • Save ed-codes/8a1b46b27dc5b9172a22 to your computer and use it in GitHub Desktop.
Save ed-codes/8a1b46b27dc5b9172a22 to your computer and use it in GitHub Desktop.
<div class="product-description rte" itemprop="description">
{% if product.description contains '<!--split-->' %}
{% assign descriptions = product.description | split: '<!--split-->' %}
{% for section in descriptions %}
{% if section contains '<!--drop-->' %}
{% assign heading = section | split: '<!--drop-->' | first %}
{% assign body = section | split: '<!--drop-->' | last %}
<div class="description-section has-drop collapsed">
<div class="drop-heading">
{{ heading }}
</div>
<div class="drop-body">
{{ body }}
</div>
</div>
{% else %}
<div class="description-section expanded">
{{ section }}
</div>
{% endif %}
{% endfor %}
{% else %}
<!-- if there is no split -->
{{ product.description }}
{% endif %}
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment