Hollo! I have another problem - I create the shortcode, that make range of array
{{ range $.Page.Params.howItWorksLeft}}
<div class="step-element">
<img src="/images/{{ .icon }}" alt="">
<p>{{ .text | markdownify }}</p>
</div>
{{ end }}
But I need to range not only howItWorksLeft, and it must work like this:
{{% features/column array=“howItWorksLeft” %}}
{{% features/column array=“howItWorksRight” %}}
{{% features/column array=“anotherArrayName” %}}
How I can do this?
Did you try
{{ range .Get "array" }}
or
{{ $array := .Get "array") }}
{{ range $array }}
?
You could also use it without attribute name, like:
{{% features/column $anotherArrayName %}}
and then use:
{{ range .Get 0 }}
(0 being the first unnamed parameter, 1 the second and so one.)
Read on:
Yes, I did. But I have:
execute of template failed: template: shortcodes/features/column.html:2:9: executing “shortcodes/features/column.html” at <$array>: range can’t iterate over howItWorksLeft
Here is array in frontmatter
howItWorksLeft:
- icon: ‘1_aahi.png’
text: teeeext teeext
- icon: ‘2_aahi.png’
text: teeext teext
- icon: ‘3_aahi.png’
text: teeext teext