{{- define "main" -}} {{- $site := .Site -}} {{- $allArticles := $site.RegularPages.ByDate.Reverse -}} {{- $recettesPrefix := "/interets/recettes/" -}} {{- $interestsArticles := slice -}} {{- $recettesArticles := slice -}} {{- $critiquesArticles := slice -}} {{- $veilleArticles := slice -}} {{- range $allArticles -}} {{- if eq (partial "is-dossier-lead.html" .) "true" -}} {{- if strings.Contains .RelPermalink "/interets/liens-interessants/" -}} {{- $veilleArticles = $veilleArticles | append . -}} {{- else if strings.Contains .RelPermalink $recettesPrefix -}} {{- $recettesArticles = $recettesArticles | append . -}} {{- else if and (strings.Contains .RelPermalink "/interets/") (not (strings.Contains .RelPermalink $recettesPrefix)) -}} {{- $interestsArticles = $interestsArticles | append . -}} {{- else if strings.Contains .RelPermalink "/critiques/" -}} {{- $critiquesArticles = $critiquesArticles | append . -}} {{- end -}} {{- end -}} {{- end -}} {{- $interestsSections := slice -}} {{- with $site.GetPage "/interets" -}} {{- range .Sections -}} {{- if and (not (strings.Contains .RelPermalink "/interets/liens-interessants/")) (not (strings.Contains .RelPermalink $recettesPrefix)) -}} {{- $interestsSections = $interestsSections | append . -}} {{- end -}} {{- end -}} {{- end -}} {{- $veilleRoot := $site.GetPage "/interets/liens-interessants" -}} {{- $recettesRoot := $site.GetPage "/interets/recettes" -}} {{- $collectionsRoot := $site.GetPage "/collections" -}} {{- $critiquesRoot := $site.GetPage "/critiques" -}} {{- $externalLinksReport := dict -}} {{- if fileExists "tools/cache/external_links.yaml" -}} {{- $externalLinksReport = transform.Unmarshal (readFile "tools/cache/external_links.yaml") -}} {{- end -}} {{- partial "hero.html" . -}} {{- $interestsUsed := slice -}} {{- $interestsSpotlight := first 8 $interestsArticles -}} {{- range $interestsSpotlight -}} {{- $interestsUsed = $interestsUsed | append .File.Path -}} {{- end -}} {{- $interestsDeep := slice -}} {{- range $interestsArticles -}} {{- if and (lt (len $interestsDeep) 15) (not (in $interestsUsed .File.Path)) -}} {{- $interestsDeep = $interestsDeep | append . -}} {{- $interestsUsed = $interestsUsed | append .File.Path -}} {{- end -}} {{- end -}} {{- $interestsSectionEntries := slice -}} {{- range $interestsSections -}} {{- $section := . -}} {{- $sectionPages := slice -}} {{- $publishedCount := 0 -}} {{- range $section.RegularPagesRecursive.ByDate.Reverse -}} {{- if eq (partial "is-dossier-lead.html" .) "true" -}} {{- $publishedCount = add $publishedCount 1 -}} {{- if and (lt (len $sectionPages) 5) (not (in $interestsUsed .File.Path)) -}} {{- $sectionPages = $sectionPages | append . -}} {{- end -}} {{- end -}} {{- end -}} {{- if gt (len $sectionPages) 0 -}} {{- $latestDateKey := "00000000000000" -}} {{- with index $sectionPages 0 -}} {{- $latestDateKey = .Date.Format "20060102150405" -}} {{- end -}} {{- $interestsSectionEntries = $interestsSectionEntries | append (dict "Section" $section "Pages" $sectionPages "PublishedCount" $publishedCount "LatestDateKey" $latestDateKey ) -}} {{- end -}} {{- end -}} {{- $interestsSectionEntries = sort $interestsSectionEntries "LatestDateKey" "desc" -}} {{- $recettesSpotlight := first 8 $recettesArticles -}} {{- $collectionsEntries := slice -}} {{- with $collectionsRoot -}} {{- range .Sections -}} {{- $section := . -}} {{- $items := $section.RegularPagesRecursive.ByDate.Reverse -}} {{- $latestItems := $items -}} {{- $latestDateKey := "00000000000000" -}} {{- if gt (len $items) 0 -}} {{- with index $items 0 -}} {{- $latestDateKey = .Date.Format "20060102150405" -}} {{- end -}} {{- end -}} {{- $collectionsEntries = $collectionsEntries | append (dict "Section" $section "Items" (len $items) "LatestItems" $latestItems "LatestDateKey" $latestDateKey ) -}} {{- end -}} {{- end -}} {{- $collectionsEntries = sort $collectionsEntries "LatestDateKey" "desc" -}} {{- $critiquesDisplayed := slice -}} {{- $critiquesCategoryDefs := slice -}} {{- $critiquesCategoryDefs = $critiquesCategoryDefs | append (dict "Path" "/critiques/films") -}} {{- $critiquesCategoryDefs = $critiquesCategoryDefs | append (dict "Path" "/critiques/series") -}} {{- $critiquesCategoryDefs = $critiquesCategoryDefs | append (dict "Path" "/critiques/jeux-video") -}} {{- $critiquesCategoryDefs = $critiquesCategoryDefs | append (dict "Path" "/critiques/livres") -}}
{{- if gt (len $interestsSpotlight) 0 -}}

À la une

{{ partial "spotlight-block.html" (dict "Cards" $interestsSpotlight "FeedPages" $interestsSpotlight "FeedTitle" "Fil de publication" "ShowFeedTitle" false "FeedRich" true "ShowSection" true "AsideFirst" false ) }}
{{- end -}} {{- if gt (len $interestsDeep) 0 -}}

Articles de fond

{{ partial "articles-list.html" (dict "Pages" $interestsDeep "Context" . "ShowDossierBeforeTitle" true) }}
{{- end -}}

Mes livres

Si vous aimez ce blog, vous apprécierez mes livres. En les achetant, vous m'aidez à continuer de le faire vivre.

{{ partial "oeuvres/l-anankeisme.html" . }} {{ partial "oeuvres/l-humain-cette-espece-primitive.html" . }}
{{- if gt (len $interestsSectionEntries) 0 -}}

Rubriques

{{- range $interestsSectionEntries -}} {{- $section := index . "Section" -}} {{- $sectionPages := index . "Pages" -}} {{- $publishedCount := index . "PublishedCount" -}} {{- if gt (len $sectionPages) 0 -}}

{{ with $section.LinkTitle }}{{ . }}{{ else }}{{ $section.Title }}{{ end }}

{{ $publishedCount }} {{ if eq $publishedCount 1 }}article{{ else }}articles{{ end }}

    {{- range $sectionPages -}} {{- $page := . -}} {{- $dossierTitle := "" -}} {{- $dossierFirstPage := false -}} {{- with $page.Params.dossier -}} {{- with index . 0 -}} {{- $dossierTitle = . -}} {{- $dossierFirstPage = partial "dossier-first-page.html" $page -}} {{- end -}} {{- end -}}
  • {{- with $dossierFirstPage -}} {{- with $dossierTitle -}}

    {{ $dossierTitle }}

    {{- end -}} {{- end -}} {{ $page.Title }} {{- with $page.Date -}}{{- end -}}
  • {{- end -}}
{{- end -}} {{- end -}}
{{- end -}} {{- if gt (len $critiquesArticles) 0 -}}

{{- with $critiquesRoot -}} {{ with .LinkTitle }}{{ . }}{{ else }}{{ .Title }}{{ end }} {{- else -}} Critiques {{- end -}}

{{- end -}} {{- range $critiqueIndex, $critiqueDef := $critiquesCategoryDefs -}} {{- $critiquePath := index $critiqueDef "Path" -}} {{- $critiquePrefix := printf "%s/" (strings.TrimSuffix "/" $critiquePath) -}} {{- $critiqueSection := $site.GetPage $critiquePath -}} {{- $critiquePool := slice -}} {{- range $critiquesArticles -}} {{- if and (strings.Contains .RelPermalink $critiquePrefix) (not (in $critiquesDisplayed .File.Path)) -}} {{- $critiquePool = $critiquePool | append . -}} {{- end -}} {{- end -}} {{- $critiqueSpotlight := first 8 $critiquePool -}} {{- range $critiqueSpotlight -}} {{- $critiquesDisplayed = $critiquesDisplayed | append .File.Path -}} {{- end -}} {{- if gt (len $critiqueSpotlight) 0 -}}

{{- with $critiqueSection -}} {{- with .LinkTitle -}}{{ . }}{{- else -}}{{ .Title }}{{- end -}} {{- else -}} Critiques {{- end -}}

{{ partial "spotlight-block.html" (dict "Cards" $critiqueSpotlight "FeedPages" $critiqueSpotlight "FeedTitle" "Dernières critiques" "ShowFeedTitle" false "FeedRich" true "ShowSection" false "AsideFirst" (eq (mod $critiqueIndex 2) 1) ) }}
{{- end -}} {{- end -}} {{- if gt (len $veilleArticles) 0 -}} {{- end -}} {{- if gt (len $recettesSpotlight) 0 -}}

{{- with $recettesRoot -}} {{ with .LinkTitle }}{{ . }}{{ else }}{{ .Title }}{{ end }} {{- else -}} Recettes {{- end -}}

{{ partial "spotlight-block.html" (dict "Cards" $recettesSpotlight "FeedPages" $recettesSpotlight "FeedTitle" "Dernières recettes" "ShowFeedTitle" false "FeedRich" true "ShowSection" false "AsideFirst" false ) }}
{{- end -}} {{- if gt (len $collectionsEntries) 0 -}}

{{- with $collectionsRoot -}} {{ with .LinkTitle }}{{ . }}{{ else }}{{ .Title }}{{ end }} {{- else -}} Collections {{- end -}}

{{- range $collectionsEntries -}} {{- $section := index . "Section" -}} {{- $latestItems := index . "LatestItems" -}}

{{ with $section.LinkTitle }}{{ . }}{{ else }}{{ $section.Title }}{{ end }}

{{- if gt (len $latestItems) 0 -}} {{- end -}}

{{ index . "Items" }} objets {{- range $section.Sections.ByTitle -}} {{ with .LinkTitle }}{{ . }}{{ else }}{{ .Title }}{{ end }} {{- end -}}

{{- end -}}
{{- end -}}
{{- end -}}