cremeaux/layouts/actualites/single.html

60 lines
2.2 KiB
HTML

{{ define "main" }}
<div class="container">
{{ $headless := site.GetPage "/" }}
{{ $widthOriginal := 1920 }}
{{ $heightOriginal := 850 }}
{{ $width := 1208 }}
{{ $height := 534 }}
{{ $image := default ($headless.Resources.GetMatch "**.jpg") (.Resources.GetMatch (default "**.jpg" .Params.image)) }}
{{ if $image }}
{{ if and (ge $image.Width $widthOriginal) (ge $image.Height $heightOriginal) }}
{{ $image = $image.Process (printf "fill %dx%d Center webp" $width $height) }}
{{ else if gt $image.Height $height }}
{{ $image = $image.Process (printf "resize x%d webp" $height) }}
{{ else }}
{{ $image = $image.Process "webp" }}
{{ end }}
<img
class="hero no-print"
src="{{ $image.RelPermalink }}"
alt="{{ or .Params.image_ .Params.image_credit }}"
title="{{ or .Params.image_ .Params.image_credit }}"
/>
{{ end }}
<h1>{{ .RenderString .Title }}</h1>
<div class="container news md">
<small>
Publié le <time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Day }} {{ index $.Site.Data.mois (printf "%d" .Date.Month) }} {{ .Date.Year }}</time>{{ if or (isset .Params "auteur") (isset .Params "authors") }} - {{ if isset .Params "authors" -}}
{{ range $key, $value := .Params.authors }}
{{ with site.GetPage $value }}
{{ if gt $key 0 }} & {{ end }}
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
{{ end }}
{{ end }}
{{- end }}{{ if isset .Params "auteur" }}{{ if isset .Params "authors" -}} & {{ end }}{{ .Params.auteur }}{{ end }}{{ end }}
</small>
{{ .Content }}
<aside>
<hr>
<h2>
{{ if and .NextInSection .PrevInSection }}
Les actualités suivantes et précédentes
{{ else if .NextInSection }}
L'actualité précédente
{{ else }}
L'actualité suivante
{{ end }}
</h2>
{{ with .NextInSection }}
{{ .Scratch.Set "big" false }}
{{ partial "article-preview.html" . }}
{{ end }}
{{ with .PrevInSection }}
{{ .Scratch.Set "big" false }}
{{ partial "article-preview.html" . }}
{{ end }}
</aside>
</div>
</div>
{{ end }}