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

<div class='paragraph_wrapper'>
  <div class='text-container'>{{ content.field_text }}</div>
  <div class='image-container'>{{ content.field_image }}</div>
</div>

The problem is I want to alternate the positions of the text & 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?


Go to Source of this post
Author Of this post: nexus_6
Title Of post: Get paragraph delta/weight in template
Author Link: {authorlink}