Get paragraph delta/weight in template I have defined a paragraph type that has a text field and an image field. At the moment the twig template is something like this

&lt;div class='paragraph_wrapper'&gt;
  &lt;div class='text-container'&gt;{{ content.field_text }}&lt;/div&gt;
  &lt;div class='image-container'&gt;{{ content.field_image }}&lt;/div&gt;
&lt;/div&gt;


The problem is I want to alternate the positions of the text &amp; image containers for each paragraph. For example the first one would have text then the image, the next would have the image then the text and so on.

How do I get the paragraph template to be aware of its order in the list? If I use a preprocess function how do I get the order than pass the value as a variable to Twig?
I'm not sure what template you're using, and I'm not sure how your site is setup. But if you have a template that is looping through and displaying these paragraphs, you can add a check in your twig file that checks if the paragraph is even or odd. 

{% for paragraph in paragraphs %}
    {% if loop.index is divisibleby(2) %}
        &lt;div class='text-container'&gt;{{ paragraph.field_text }}&lt;/div&gt;
        &lt;div class='image-container'&gt;{{ paragraph.field_image }}&lt;/div&gt;
    {% else %}
        &lt;div class='image-container'&gt;{{ paragraph.field_image }}&lt;/div&gt;
        &lt;div class='text-container'&gt;{{ paragraph.field_text }}&lt;/div&gt;
    {% endif %}
{% endfor %}