69 lines
2.6 KiB
HTML
69 lines
2.6 KiB
HTML
{{- define "main" }}
|
||
{{- $site := .Site -}}
|
||
{{- $logoPath := $site.Params.logo | default "logo-large.png" -}}
|
||
{{- $logo := resources.GetMatch $logoPath -}}
|
||
{{- $siteDescription := $site.Params.description -}}
|
||
{{- $allArticles := $site.RegularPages.ByDate.Reverse -}}
|
||
{{- $totalArticles := len $site.RegularPages -}}
|
||
{{- $allSections := where $site.Pages "Kind" "section" -}}
|
||
{{- $allSections = where $allSections "RelPermalink" "!=" "/" -}}
|
||
{{- $leafSections := slice -}}
|
||
{{- range $allSections -}}
|
||
{{- if eq (len .Sections) 0 -}}
|
||
{{- $leafSections = $leafSections | append . -}}
|
||
{{- end -}}
|
||
{{- end -}}
|
||
{{- $sectionsCount := len $leafSections -}}
|
||
{{- $lastUpdated := $site.Lastmod -}}
|
||
|
||
<main>
|
||
{{- partial "home-hero.html" (dict "Logo" $logo "Title" $site.Title "Description" $siteDescription "Content" .Content "TotalArticles" $totalArticles "SectionsCount" $sectionsCount "LastUpdated" $lastUpdated "HeroMenu" $site.Menus.hero) -}}
|
||
|
||
{{- $featured := index $allArticles 0 -}}
|
||
{{- $used := slice $featured.File.Path -}}
|
||
|
||
<section class="articles-list featured-section">
|
||
<h2>En vedette</h2>
|
||
{{- partial "featured-card.html" (dict "Page" $featured) -}}
|
||
</section>
|
||
|
||
{{- $recent := first 4 (after 1 $allArticles) -}}
|
||
{{- range $recent }}
|
||
{{- $used = $used | append .File.Path -}}
|
||
{{- end -}}
|
||
|
||
<section class="articles-list">
|
||
<h2>Dernières publications</h2>
|
||
{{- partial "articles-list.html" (dict "Pages" $recent "Context" .) -}}
|
||
</section>
|
||
|
||
{{- 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 -}}
|
||
<section class="articles-list">
|
||
{{- $trail := slice -}}
|
||
{{- range $ancestor := $section.Ancestors.Reverse -}}
|
||
{{- if ne $ancestor.RelPermalink "/" -}}
|
||
{{- $trail = $trail | append $ancestor -}}
|
||
{{- end -}}
|
||
{{- end -}}
|
||
<nav aria-label="Fil d’Ariane">
|
||
<ol>
|
||
{{- range $item := $trail -}}
|
||
<li><a href="{{ $item.RelPermalink }}">{{ with $item.LinkTitle }}{{ . }}{{ else }}{{ $item.Title }}{{ end }}</a></li>
|
||
{{- end -}}
|
||
</ol>
|
||
</nav>
|
||
<h2><a href="{{ $section.RelPermalink }}">{{ with $section.LinkTitle }}{{ . }}{{ else }}{{ $section.Title }}{{ end }}</a></h2>
|
||
{{- partial "articles-list.html" (dict "Pages" $sectionPages "Context" .) -}}
|
||
</section>
|
||
{{- end -}}
|
||
</main>
|
||
{{- end }}
|