{{ $articles := slice}} {{ range where .Site.Pages "Section" "articles" }} {{ with .File }} {{ $subDirsNumer := .File.Path | strings.Count "/" }} {{ if eq $subDirsNumer 2 }} {{ $articles = $articles | append (dict "page" . "path" .File.Path) }} {{ end }} {{ end }} {{ end }}