Denys Konovalov
799acd03a9
- Standartisierung der Karten-/Template-Elemente (schließt #224) - Verbesserung einiger Ansichten - "schrumpfung" - Code-Cleanups - Trabsliteration Kategorien u. v. m.
33 lines
1.8 KiB
HTML
33 lines
1.8 KiB
HTML
|
|
<link rel="stylesheet" href={{ "css/hugo-easy-gallery.css" | relURL }} />
|
|
{{ $baseURL := .Site.BaseURL }}
|
|
<div class="gallery caption-position-{{ with .Get "caption-position" | default "bottom" }}{{.}}{{end}} caption-effect-{{ with .Get "caption-effect" | default "slide" }}{{.}}{{end}} hover-effect-{{ with .Get "hover-effect" | default "zoom" }}{{.}}{{end}} {{ if ne (.Get "hover-transition") "none" }}hover-transition{{end}}" itemscope itemtype="http://schema.org/ImageGallery">
|
|
{{- with (.Get "dir") -}}
|
|
{{- $files := readDir (print "/static/" .) }}
|
|
{{- range $files -}}
|
|
{{- $thumbext := $.Get "thumb" | default "-thumb" }}
|
|
{{- $isthumb := .Name | findRE ($thumbext | printf "%s\\.") }}
|
|
{{- $isimg := lower .Name | findRE "\\.(gif|jpg|jpeg|tiff|png|bmp|webp|avif|jxl)" }}
|
|
{{- if and $isimg (not $isthumb) }}
|
|
{{- $caption := .Name | replaceRE "\\..*" "" | humanize }}
|
|
{{- $linkURL := print $baseURL "/" ($.Get "dir") "/" .Name | absURL }}
|
|
{{- $thumb := .Name | replaceRE "(\\.)" ($thumbext | printf "%s.") }}
|
|
{{- $thumbexists := where $files "Name" $thumb }}
|
|
{{- $thumbURL := print $baseURL ($.Get "dir") "/" $thumb | absURL }}
|
|
<div class="box">
|
|
<figure itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
|
|
<div class="img" style="background-image: url('{{ if $thumbexists }}{{ $thumbURL }}{{ else }}{{ $linkURL }}{{ end }}');" >
|
|
<img itemprop="thumbnail" src="{{ if $thumbexists }}{{ $thumbURL }}{{ else }}{{ $linkURL }}{{ end }}" alt="{{ $caption }}" /><!-- <img> hidden if in .gallery -->
|
|
</div>
|
|
<figcaption>
|
|
<p>{{ $caption }}</p>
|
|
</figcaption>
|
|
<a href="{{ $linkURL }}" itemprop="contentUrl"></a>
|
|
</figure>
|
|
</div>
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- else -}}
|
|
{{ .Inner }}
|
|
{{- end }}
|
|
</div> |