ltqf/layouts/presse/list.html
Florian du Garage Num 04b26ad4e8 SEO
2023-12-15 12:58:54 +01:00

69 lines
2.8 KiB
HTML

{{ define "styles"}}
{{ $customCSS := resources.Get "css/presse.css" | resources.ToCSS }}
<link rel="stylesheet" href="{{ $customCSS.RelPermalink }}">
{{ end }}
{{ define "content" }}
<section class="section has-background-warning-light">
<div>
<h1>{{ .Title }}</h1>
{{ range where .Site.RegularPages "Section" "spectacles" }}
{{ $spectacle := .File.Dir }}
{{ if and (isset .Params "presse") (.Params.presse) }}
{{ $img := resources.GetMatch (print .File.Dir "/principal.*") }}
{{ with $img }}
{{- $jpeg := .Crop "1400x400 jpeg" }}
{{- $webp := .Crop "1400x400 webp picture" }}
<div class="columns fond border my-6 p-6 has-background-black" style="background-image: url('{{ $webp.Permalink }}');">
{{ end }}
<div class="column border has-background-black has-text-white">
<!-- <div class="gauche"> -->
<p class="mb-3 is-uppercase">{{ .Title }}</p>
<span> {{ .Date.Year }} </span>
<!-- </div> -->
</div>
<div class="column border is-three-fifths ml-5-tablet has-background-warning-light">
<div>Critiques</div>
<div>
{{ range .Params.presse }}
<div>
<span>{{ .revue }}</span>
{{ if .lien }}
{{ $.Scratch.Set "link" "" }}
{{ $.Scratch.Set "message" "" }}
{{ if strings.HasSuffix .lien ".pdf" }}
{{ $exactMatch := resources.GetMatch (print $spectacle .lien) }}
{{ if $exactMatch }}
{{ $.Scratch.Set "link" $exactMatch.Permalink }}
{{ $.Scratch.Set "message" " - Télécharger " }}
{{ else }}
{{ $fallbackPDF := resources.GetMatch (print $spectacle "/*.pdf") }}
{{ if $fallbackPDF }}
{{ $.Scratch.Set "link" $fallbackPDF.Permalink }}
{{ $.Scratch.Set "message" " - Télécharger " }}
{{ end }}
{{ end }}
{{ else }}
{{ $.Scratch.Set "link" .lien }}
{{ $.Scratch.Set "message" " - Accéder à "}}
{{ end }}
{{ with $.Scratch.Get "link" }}
<a href="{{ . }}" target="_blank" rel="canonical" aria-label="Lien vers la revue de presse">{{ $.Scratch.Get "message" }} la revue</a>
{{ end }}
{{ end }}
</div>
{{ end }}
</div>
</div>
</div>
{{ end}}
{{ end }}
</div>
</section>
{{ end }}