1

Initial commit

This commit is contained in:
2025-03-28 12:57:37 +01:00
commit ed9ddcfdc8
1841 changed files with 42303 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
{{- $imgPath := .Destination -}}
{{- $imgName := path.Base $imgPath | replaceRE "\\.[^.]+$" "" -}} {{/* Supprime l'extension */}}
{{- $dataPath := printf "data/images/%s.yaml" $imgName -}}
{{- $dataFile := .Page.Resources.Get $dataPath -}}
{{- $data := dict -}}
{{- if $dataFile }}
{{- $data = $dataFile.Content | transform.Unmarshal -}}
{{- end }}
{{- $alt := .PlainText | default $data.title | default "" -}}
{{- $title := .Title | default $data.title | default "" -}}
{{- $image := .Page.Resources.GetMatch $imgPath -}}
{{- $isBlock := .IsBlock -}}
{{- if $image }}
{{- $resized := $image.Resize (cond (eq $isBlock true) "1024x" "500x") -}}
{{- $large := $image.Resize "1920x" -}}
{{- if $isBlock }}
<figure class="custom-image center">
<a href="{{ $large.RelPermalink }}" title="Cliquez pour agrandir l'image">
<img src="{{ $resized.RelPermalink }}" alt="{{ $alt }}" title="{{ $title }}" />
</a>
{{- if $data.prompt }}
<details>
<summary>
<strong>Attribution :</strong>
{{- with $data.attribution }}<em>{{ . | markdownify }}</em>{{- end }}
</summary>
<p><strong>Prompt :</strong> <em>{{ $data.prompt }}</em></p>
</details>
{{- else }}
{{- with $data.attribution }}
<p class="details">
<strong>Attribution :</strong>
<em>{{ . | markdownify }}</em>
</p>
{{- end }}
<figcaption>
{{- with $data.description }}
<p>{{ . | markdownify }}</p>
{{- end }}
</figcaption>
{{- end }}
</figure>
{{- else }}
<img src="{{ $resized.RelPermalink }}" alt="{{ $alt }}" title="{{ $title }}">
{{- end }}
{{- else }}
{{- if $isBlock }}
<figure>
<img src="{{ $imgPath | safeURL }}" alt="{{ $alt }}" title="{{ $title }}">
{{- with $title }}<figcaption>{{ . }}</figcaption>{{ end }}
</figure>
{{- else }}
<img src="{{ $imgPath | safeURL }}" alt="{{ $alt }}" title="{{ $title }}">
{{- end }}
{{- end }}

View File

@@ -0,0 +1,22 @@
{{- $isExternal := strings.HasPrefix .Destination "http" -}}
{{- $parsed := urls.Parse .Destination -}}
{{- $host := $parsed.Host -}}
{{- $path := $parsed.Path -}}
{{- $query := $parsed.RawQuery -}}
{{- $aff := index site.Data.affiliates.sites $host -}}
{{- $isAffiliated := false -}}
{{- $newURL := .Destination -}}
{{- if and $isExternal $aff -}}
{{- $param := $aff.param -}}
{{- $value := $aff.value -}}
{{- $isAffiliated = true -}}
{{- if $query }}
{{- $newURL = printf "%s://%s%s?%s&%s=%s" $parsed.Scheme $host $path $query $param $value -}}
{{- else }}
{{- $newURL = printf "%s://%s%s?%s=%s" $parsed.Scheme $host $path $param $value -}}
{{- end }}
{{- end -}}
<a href="{{ $newURL }}" title="{{ .Title }}"
{{- if $isExternal -}} rel="noreferrer" class="external-link{{ if $isAffiliated }} affiliated{{ end }}{{ if $isExternal }} external{{ end }}" {{- end -}}>
{{- .Text | safeHTML -}}
</a>