Last active
December 7, 2018 13:13
-
-
Save andreibabor/df2a281ad745befadfb8744553204f8c to your computer and use it in GitHub Desktop.
split collection description in 2 paragraphs
This file contains hidden or 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
//alt code smecher de la un client | |
{% assign descriptions = product.description | split: "<h5>" %} | |
{% for description_block in descriptions %} | |
{% if forloop.first == true %} | |
{{ description_block }} | |
{% else %} | |
{% assign split_block = description_block | split: "</h5>" %} | |
<div class="accordion" id="section{{forloop.index}}"> | |
<h5>{{ split_block[0] }}</h5> | |
</div> | |
<div class="content"> | |
{{ split_block[1] }} | |
</div> | |
{% endif %} | |
{% endfor %} |
This file contains hidden or 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
{% assign descriptions = collection.description | split: "<!-- split -->" %} | |
{% assign short_desc = descriptions[0] %} | |
{% assign long_desc = descriptions[1] %} | |
Then put the individual descriptions whereever you want them on the page with | |
{{ short_desc }} and {{ long_desc }}, respectively. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment