SHARE
TWEET

Untitled

a guest May 21st, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. When doing something like <!--video-id:abcabc-->
  2.  
  3. {% assign video-id = collection.description | split: 'video-id:' | last | split: '-->' | first %}
  4.  
  5. When you need multiple and dont know how many,
  6.  
  7. Example images for a slider:
  8.  
  9. {% assign inaction-images = collection.description | split: '<!--endinaction-->' | first | split: '<img' %}
  10.  
  11. {% for image in inaction-images %}
  12.   {% if forloop.first == true %}
  13.     {% comment %}do nothing because this is text/html before the img tag{% endcomment %}
  14.   {% else %}
  15.     {% assign src = image | split: ' src="' | last | split:'"' | first %}
  16.     <a href="javascript:;" class="js-in-action-image" data-sort="0" data-image="{{ src }}" data-zoom-image="{{ src }}">
  17.       <img src="{{ src }}" />
  18.     </a>
  19.    {% endif %}
  20. {% endfor %}
  21.  
  22. Example, handles grabbed from a list of comments <!--add-on:test-chocolate--><!--add-on:test-liquor-->
  23.  
  24. {% if product.description contains 'add-on:' %}
  25.  
  26.   {% assign add-on-list = product.description | split: 'add-on:' %}
  27.  
  28.   <div class="add-ons">
  29.    
  30.     {% for add-on in add-on-list %}
  31.       {% unless forloop.first %}
  32.         {% assign handle = add-on | split: ':' | last | split: '-->' | first %}
  33.  
  34.         <div class="add-on-item">
  35.           <p>{{ all_products[handle].title }}</p>
  36.           <img src="{{ all_products[handle].featured_image | img_url: '200x' }}" alt="">
  37.         </div>
  38.  
  39.       {% endunless %}
  40.     {% endfor %}
  41.  
  42.   </div>
  43.  
  44. {% endif %}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top