{{- $context := .context -}} {{- $position := .block.position -}} {{- $title := .block.title -}} {{- $class := "block block-pages" -}} {{- $layout_class := "block-pages--grid" -}} {{- with .block.data -}} {{- $layout := .layout -}} {{- $show_main_page := false -}} {{- $show_main_description := .show_main_description -}} {{- $show_descriptions := .show_descriptions -}} {{- $show_images := .show_images -}} {{- $main_description := "" -}} {{- $page_link := false -}} {{/* LEGACY */}} {{- with .show_description -}} {{- $show_descriptions = . -}} {{- end -}} {{- with .show_image -}} {{- $show_images = . -}} {{- end -}} {{- if $layout -}} {{- $layout_class = printf "block-pages--%s" $layout -}} {{- end -}} {{ $class = printf "{{$class}} %s" $layout_class }} {{- $page_class := "" -}} {{ $page := partial "GetPageByUrl" .page }} {{- with $page }} {{- $show_main_page = true -}} {{- $page_link = $page.Permalink }} {{ if eq $title "" }} {{ $title = .Title }} {{ end }} {{ if .Params.bodyclass }} {{- $page_class = partial "GetBodyclass" . }} {{- $page_class = printf "block-%s" $page_class }} {{ end }} {{ if site.Params.pages.list.truncate_description }} {{- $main_description = partial "GetTruncateContent" ( dict "text" .Params.description_short "length" site.Params.pages.list.truncate_description ) -}} {{ else }} {{- $main_description = partial "PrepareHTML" .Params.description_short -}} {{ end }} {{ end -}}
{{- if $title }}
{{/* Quand le bloc a un titre, est-ce qu'on prend le titre de la page principale ou le titre du bloc ? */}} {{ partial "blocks/title" (dict "title" $title "context" $context "link" $page_link ) }} {{ if and $show_main_description (ne $layout "list")}} {{- with $page }}

{{- $main_description -}}

{{ end }} {{ end }}
{{ end -}} {{ if and $show_main_description (eq $layout "list")}} {{- with $page }}

{{- $main_description -}}

{{ end }} {{ end }} {{- partial (printf "blocks/templates/pages/%s.html" $layout) (dict "pages" .pages "show_images" $show_images "show_descriptions" $show_descriptions ) }}
{{- end -}}