Answers.Body: <p>This will do it:</p>
  
  <pre><code>{% for key, image in block.images %}
      {{ key }} - &lt;img src="{{ image.url }}" data-index="{{ key }}"&gt;
  {% endfor %}
  </code></pre>
  
  <p>Keep in mind that's a 0 based array, so the first image will output 0, the 2nd 1, etc.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-12-11T03:15:38.153Z
Answers.LastActivityDate: 2014-12-11T04:13:35.960Z
Answers.LastEditDate: 2014-12-11T04:13:35.960Z
Answers.UserDisplayName: Brad Bell
Body: <p>Looking to do something like this:</p>
  
  <pre><code>{% for image in block.images %}
      &lt;img src="{{ image.url }}" data-index="{{ image.index }}"&gt;
  {% endfor %}
  </code></pre>
  
  <p>This seems like it should be easy and I feel like I've done it before, however I can't seem to figure it out. Thanks</p>
  
Tags: <templating><assets>
Title: How do I display the index of the asset in assets loop?
ThreadText: # How do I display the index of the asset in assets loop?
  
  (Asked by: username_0 on 2014-12-11)
  
  Looking to do something like this:
  
  ```
  {% for image in block.images %}
      <img src="{{ image.url }}" data-index="{{ image.index }}">
  {% endfor %}
  
  ```
  
  This seems like it should be easy and I feel like I've done it before, however I can't seem to figure it out. Thanks
  
  **Tags:** templating, assets
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-12-11. Score: 3 | Accepted answer
  
  This will do it:
  
  ```
  {% for key, image in block.images %}
      {{ key }} - <img src="{{ image.url }}" data-index="{{ key }}">
  {% endfor %}
  
  ```
  
  Keep in mind that's a 0 based array, so the first image will output 0, the 2nd 1, etc.
  
  
  ---
  
  