Nouveau thème pour 2026
This commit is contained in:
34
themes/2026/layouts/_shortcodes/extimage.html
Normal file
34
themes/2026/layouts/_shortcodes/extimage.html
Normal file
@@ -0,0 +1,34 @@
|
||||
{{- $imageURL := .Get 0 -}}
|
||||
{{- $title := .Get 2 | default "" -}}
|
||||
{{- $description := .Get 3 | default "" -}}
|
||||
{{- $attribution := .Get 4 | default "" -}}
|
||||
{{- $remoteURL := printf "%s?raw=true" $imageURL -}}
|
||||
{{- $remoteImage := resources.GetRemote $remoteURL -}}
|
||||
{{- $hash := md5 $remoteURL -}}
|
||||
{{- $extension := path.Ext $remoteURL -}}
|
||||
{{- $cleanFilename := printf "%s%s" $hash $extension | replace "?raw=true" "" -}}
|
||||
{{- $localImage := $remoteImage | resources.Copy (printf "remote-images/%s" $cleanFilename) -}}
|
||||
{{- $resizedImage := $localImage.Resize "1024x" -}}
|
||||
{{- $hasMeta := or $title (or $description $attribution) -}}
|
||||
<figure class="figure-media{{ if $hasMeta }} figure-media-with-meta{{ else }} figure-media-without-meta{{ end }}">
|
||||
<a href="{{ $localImage.RelPermalink }}" title="Cliquez pour agrandir l'image">
|
||||
<img src="{{ $resizedImage.RelPermalink }}" alt="{{ $title }}" title="{{ $title }}">
|
||||
</a>
|
||||
{{- if $hasMeta -}}
|
||||
<figcaption class="figure-media-meta cover-meta">
|
||||
<div class="figure-media-meta-main">
|
||||
{{- with $title -}}
|
||||
<p class="figure-title cover-title">{{ . | markdownify }}</p>
|
||||
{{- end -}}
|
||||
{{- with $description -}}
|
||||
<p class="figure-description cover-description">{{ . | markdownify }}</p>
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{- with $attribution -}}
|
||||
<div class="figure-media-meta-extra">
|
||||
<p class="figure-attribution cover-attribution"><strong>Attribution :</strong> <span>{{ . | markdownify }}</span></p>
|
||||
</div>
|
||||
{{- end -}}
|
||||
</figcaption>
|
||||
{{- end -}}
|
||||
</figure>
|
||||
21
themes/2026/layouts/_shortcodes/sound.html
Normal file
21
themes/2026/layouts/_shortcodes/sound.html
Normal file
@@ -0,0 +1,21 @@
|
||||
{{- $soundData := .Get 0 -}}
|
||||
{{- $dataFile := .Page.Resources.Get (printf "data/sounds/%s.yaml" $soundData) -}}
|
||||
{{- if $dataFile -}}
|
||||
{{- $data := $dataFile.Content | transform.Unmarshal -}}
|
||||
{{- $audio := .Page.Resources.Get $data.file -}}
|
||||
{{- if $audio -}}
|
||||
<figure>
|
||||
<audio controls preload="metadata">
|
||||
<source src="{{ $audio.RelPermalink }}">
|
||||
Votre navigateur ne prend pas en charge la lecture audio.
|
||||
</audio>
|
||||
{{- if or $data.title (or $data.description $data.attribution) -}}
|
||||
<figcaption>
|
||||
{{- with $data.title -}}<p><strong>{{ . }}</strong></p>{{- end -}}
|
||||
{{- with $data.description -}}<p>{{ . | markdownify }}</p>{{- end -}}
|
||||
{{- with $data.attribution -}}<p><strong>Attribution :</strong> <em>{{ . | markdownify }}</em></p>{{- end -}}
|
||||
</figcaption>
|
||||
{{- end -}}
|
||||
</figure>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
40
themes/2026/layouts/_shortcodes/video.html
Normal file
40
themes/2026/layouts/_shortcodes/video.html
Normal file
@@ -0,0 +1,40 @@
|
||||
{{- $videoData := .Get 0 -}}
|
||||
{{- $dataFile := .Page.Resources.Get (printf "data/videos/%s.yaml" $videoData) -}}
|
||||
{{- if $dataFile -}}
|
||||
{{- $data := $dataFile.Content | transform.Unmarshal -}}
|
||||
{{- $video := .Page.Resources.Get $data.file -}}
|
||||
{{- if $video -}}
|
||||
{{- $hasMeta := or $data.title (or $data.description (or $data.attribution $data.prompt)) -}}
|
||||
<figure class="figure-media{{ if $hasMeta }} figure-media-with-meta{{ else }} figure-media-without-meta{{ end }}">
|
||||
<video controls preload="metadata" width="100%">
|
||||
<source src="{{ $video.RelPermalink }}" type="video/mp4">
|
||||
Votre navigateur ne prend pas en charge la lecture des videos.
|
||||
</video>
|
||||
{{- if $hasMeta -}}
|
||||
<figcaption class="figure-media-meta cover-meta">
|
||||
<div class="figure-media-meta-main">
|
||||
{{- with $data.title -}}
|
||||
<p class="figure-title cover-title">{{ . | markdownify }}</p>
|
||||
{{- end -}}
|
||||
{{- with $data.description -}}
|
||||
<p class="figure-description cover-description">{{ . | markdownify }}</p>
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{- if or $data.attribution $data.prompt -}}
|
||||
<div class="figure-media-meta-extra">
|
||||
{{- with $data.attribution -}}
|
||||
<p class="figure-attribution cover-attribution"><strong>Attribution :</strong> <span>{{ . | markdownify }}</span></p>
|
||||
{{- end -}}
|
||||
{{- with $data.prompt -}}
|
||||
<details>
|
||||
<summary>Prompt</summary>
|
||||
<p>{{ . | markdownify }}</p>
|
||||
</details>
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
</figcaption>
|
||||
{{- end -}}
|
||||
</figure>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
Reference in New Issue
Block a user