feat: Ajout d'un module pour afficher une galerie
This commit is contained in:
30
layouts/shortcodes/gallery.html
Normal file
30
layouts/shortcodes/gallery.html
Normal file
@ -0,0 +1,30 @@
|
||||
{{ $baseURL := .Page.RelPermalink }}
|
||||
{{ $resources := .Page.Resources }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="masonry" itemscope itemtype="http://schema.org/ImageGallery">
|
||||
{{ range .Params }}
|
||||
<figure itemscope class="brick" itemtype="http://schema.org/ImageObject">
|
||||
{{ $path := . }}
|
||||
{{ $text := "" }}
|
||||
{{ if in . ":" }}
|
||||
{{ $arg := split . ":" }}
|
||||
{{ $path = index $arg 0 }}
|
||||
{{ $text = index $arg 1 }}
|
||||
{{ end }}
|
||||
|
||||
{{ $image := $resources.GetMatch (printf "*%s*" $path) }}
|
||||
{{ $orientation := 1 }}
|
||||
{{ with $image }}{{ with .Exif }}{{ $orientation = .Tags.Orientation }}{{ end }}{{ end }}
|
||||
{{ if eq $orientation 8 }}
|
||||
{{ $image = $image.Resize "300x r90" }}
|
||||
{{ else if eq $orientation 6 }}
|
||||
{{ $image = $image.Resize "300x r270" }}
|
||||
{{ end }}
|
||||
{{ $resized := $image.Resize "300x q100 webp" }}
|
||||
<img src="{{ $resized.RelPermalink }}" alt="{{ $text }}" title="{{ $text }}" loading="lazy">
|
||||
</figure>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="container news md">
|
Reference in New Issue
Block a user