Get certain values in an array?

Hi guys,

ranking = [ "luke-bryan/drink-a-beer", "dan-+-shay/10000-hours", "luke-bryan/drink-a-coke", "luke-combs/say-hi..........

{{ range .Site.Data.itunes.ranking }}

What if I want to get for example 10th until 20th, the values from my data ranking file?

Thank you :slight_smile:

i tried {{ slicestr .Site.Data.itunes.ranking 0 3}}

but no luck :frowning:

{{ range $index, $element := .Site.Data.itunes.ranking }}
{{ if eq $index 1 }}

I think this is it. It returns the second song in the array.
How can I specify 10th to 20th ?
if gt $index 8 and if lt $index 20 ?

{{ if and ( gt $index 8 ) ( lt $index 20 ) }}

this seems working …

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