{{ $highlights := where (where $.Site.Pages "Section" "highlights" ) "Kind" "page" }} {{ $currentPage := path.Split (path.Clean .RelPermalink) }} {{ $displayedInHome := .IsHome }} {{ $isSingleHighlightPage := and (eq $currentPage.Dir "/highlights/") ($currentPage.File) }} {{ $highlights_to_show := slice }} {{/* Compile list of highlight to show depending upon the page */}} {{ if $displayedInHome }} {{ $highlights_to_show = $highlights_to_show | append (first 3 $highlights) }} {{ else if $isSingleHighlightPage }} {{ $highlights_to_show = $highlights_to_show | append (first 4 (.Scratch.Get "highlights_list")) }} {{ else if strings.HasSuffix $currentPage.Dir "/topics/" }} {{ range $highlights }} {{if in (apply .Params.highlights_topics "urlize" ".") $currentPage.File }} {{ $highlights_to_show = $highlights_to_show | append . }} {{ end }} {{ end }} {{ if strings.HasPrefix $currentPage.Dir "/topics/" }} {{ $highlights_to_show = first 3 $highlights_to_show }} {{ end }} {{ else }} {{ $highlights_to_show = $highlights_to_show | append $highlights }} {{ end }}