Introduction du nouveau thème
This commit is contained in:
41
themes/42/layouts/home.html
Normal file
41
themes/42/layouts/home.html
Normal file
@@ -0,0 +1,41 @@
|
||||
{{- 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 -}}
|
||||
<main id="home">
|
||||
{{- $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 -}}
|
||||
</main>
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user