In a multi-lingual site, on list pages we have a simple
{{- $pages := where (.RegularPages | lang.Merge .Sites.Default.RegularPages) "Section" .Section -}}
to get all pages in the current section and “fill in” with the default (English) site ones when translations are missing.
Now, on the homepage, we want to get only a subset of the pages that have a category: categories
taxonomy and show only the latest page by category:
{{- if .IsHome -}}
{{- $homePages := slice -}}
{{- range site.Taxonomies.categories.ByCount -}}
{{- range first 1 .Pages -}}
{{- $homePages = $homePages | append . -}}
{{- end -}}
{{- end -}}
{{- $pages = $homePages -}}
{{- end -}}
It works well for the English site where all pages exist, but less so on translations with missing pages. How would you “fill in” the English pages for translated sites? TIA!