Range through languages individually

The code works to get the first and last language - range first 1 .AllTranslations range last 1 .AllTranslations. Can the same code be used to pick languages individually (based on weight)? For example, picking languages 2 and 3? Or does this require hard coding the languages?

Use index

Thanks. This worked

{{ $slice := slice  "lang1" "lang2" "lang3" "lang4" "lang5" }}
 {{ $index := index $slice 3 <!--- starts from 0 --> }} 
 {{ if eq .Language.Lang $index }}
 <!--- code here -->
 {{ end }}
1 Like

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