" %} {% for member in beatles %} {{ member }} {% if forloop.index" /> " %} {% for member in beatles %} {{ member }} {% if forloop.index" /> " %} {% for member in beatles %} {{ member }} {% if forloop.index"/>

Shopify/Liquid: Random order of content

18 Views Asked by At

In my liquid template, I am using:

{% assign beatles = article.content | split: "</p>" %}
{% for member in beatles %}
  {{ member }}
  {% if forloop.index == 3 %}
    <p>1</p>
  {% endif %}
  {% if forloop.index == 6 %}
    <p>2</p>
  {% endif %}
  {% if forloop.index == 9 %}
    <p>3</p>
  {% endif %}
  {% if forloop.index == 12 %}
    <p>4</p>
  {% endif %}
  {% if forloop.index == 15 %}
    <p>5</p>
  {% endif %}
{% endfor %}

What I want to do is have random order for this content appearing (rather than 1 always appearing after the third paragraph instance for example. But the values should be unique - so each number does not appear twice.

Any idea on how I can achieve this?

0

There are 0 best solutions below