{{- define "main" }} {{- $site := .Site -}} {{- $allArticles := $site.RegularPages.ByDate.Reverse -}} {{- $allSections := where $site.Pages "Kind" "section" -}} {{- $allSections = where $allSections "RelPermalink" "!=" "/" -}} {{- $leafSections := slice -}} {{- range $allSections -}} {{- if eq (len .Sections) 0 -}} {{- $leafSections = $leafSections | append . -}} {{- end -}} {{- end -}} {{- partial "hero.html" . -}} {{- $used := slice -}}
{{- $recent := first 4 ($allArticles) -}} {{- range $recent }} {{- $used = $used | append .File.Path -}} {{- end -}} {{- partial "home-section.html" (dict "SectionPages" $recent "Title" "Dernières publications" "Context" .) -}} {{- range sort $leafSections "Lastmod" "desc" -}} {{- $section := . -}} {{- $sectionPages := slice -}} {{- range $section.RegularPagesRecursive.ByDate.Reverse -}} {{- if not (in $used .File.Path) -}} {{- $sectionPages = $sectionPages | append . -}} {{- end -}} {{- end -}} {{- $sectionPages = first 4 $sectionPages -}} {{- if gt (len $sectionPages) 0 -}} {{- range $sectionPages -}} {{- $used = $used | append .File.Path -}} {{- end -}} {{- partial "home-section.html" (dict "SectionPages" $sectionPages "Section" $section "Context" .) -}} {{- end -}} {{- end -}}
{{- end }}