Simple Iteration

I am trying to do this:

{% for i in (0..24) %}
    <img src="{{ include.username }}/small/{{ i }}.jpg" alt="Instagram picture {{ i | plus:1 }}" />
{% endfor %}

Its so simple but totally unfathomable for me from hugo documentation.


Hi David,

I edited your post, enclosing your code within code fences so that it is easier for others to understand your question.

I think you want something like this:

{{ range $i := seq 0 24 }}
  <img src="{{ $username }}/small/{{ $i }}.jpg" alt="Instagram picture {{ add 1 $i }}">
{{ end }}


1 Like

Thanks a million for your help.


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.