Repeating HTML element n times [solved]

I would like to repeat an element n times inside a template. n would be equal to the rating of each skill as defined in the configs:

[params.about.skills]
    skill = "Programming"
    value = 7

Therefore I would like to do something like this (in Python):

for i in range(1, value):
    print("<span></span>")

But range doesn’t seem to work that way because it doesn’t generate a sequence, instead it takes one and iterates over it.

The problem can be solved by using the seq template function.

{{ range (seq .Site.Params.about.skills.value) }}
    <span></span>
{{ end }}
2 Likes