Use Gallery for Full Folder

This commit is contained in:
2022-10-12 14:28:13 +02:00
parent 487f37bc5e
commit f6164e075e
4 changed files with 10 additions and 17 deletions

View File

@@ -5,3 +5,7 @@ date: 2021-12-12T00:00:00+01:00
latitude: "45.761727" latitude: "45.761727"
longitude: "4.829074" longitude: "4.829074"
--- ---
{{<load-photoswipe>}}
### Photos
{{<gallery class="galleryMarginHorizontal" dir="images/2021-12-12" boxClass="twoTilesBoxes"/>}}

View File

@@ -11,8 +11,4 @@ Festival Rock à Fond organisé par les Gazafond à Manziat (01570)
{{<load-photoswipe>}} {{<load-photoswipe>}}
### Photos ### Photos
{{<gallery>}} {{<gallery class="galleryMarginHorizontal" dir="/images/2022-07-30/"/>}}
{{<figure src="/images/2022-07-30/IMG_20220730_200333.jpg">}}
{{<figure src="/images/2022-07-30/IMG_20220730_202412.jpg">}}
{{<figure src="/images/2022-07-30/IMG_20220730_202417.jpg">}}
{{</gallery>}}

View File

@@ -15,16 +15,8 @@ Matinale Musicale de 7:00 à 8:00 place Charles Hernu à Charpennes, sur une id
{{<load-photoswipe>}} {{<load-photoswipe>}}
### Photos ### Photos
{{< gallery >}} {{<gallery class="galleryMarginHorizontal" dir="/images/2022-10-11/"/>}}
{{<figure src="/images/2022-10-11/20221011_073144.jpg">}}
{{<figure src="/images/2022-10-11/20221011_073424.jpg">}}
{{<figure src="/images/2022-10-11/20221011_075118.jpg">}}
{{<figure src="/images/2022-10-11/20221011_075123.jpg">}}
{{<figure src="/images/2022-10-11/20221011_075127.jpg">}}
{{<figure src="/images/2022-10-11/20221011_075131.jpg">}}
{{<figure src="/images/2022-10-11/20221011_075140.jpg">}}
{{< /gallery >}}
## Vidéo ### Vidéo
{{< peertube class="marginHorizontal" src="https://tube.pustule.org/videos/embed/7c3bd887-bf16-4acd-bc6b-baa581311b87?warningTitle=0&p2p=0" >}} {{< peertube class="marginHorizontal" src="https://tube.pustule.org/videos/embed/7c3bd887-bf16-4acd-bc6b-baa581311b87?warningTitle=0&p2p=0" >}}

View File

@@ -6,10 +6,11 @@ Documentation and licence at https://github.com/liwenyip/hugo-easy-gallery/
{{- if not ($.Page.Scratch.Get "figurecount") }}<link rel="stylesheet" href={{ "css/hugo-easy-gallery.css" | relURL }} />{{ end }} {{- if not ($.Page.Scratch.Get "figurecount") }}<link rel="stylesheet" href={{ "css/hugo-easy-gallery.css" | relURL }} />{{ end }}
{{- $.Page.Scratch.Add "figurecount" 1 }} {{- $.Page.Scratch.Add "figurecount" 1 }}
{{ $baseURL := .Site.BaseURL }} {{ $baseURL := .Site.BaseURL }}
<div class="gallery {{ with .Get "class"}}{{.}}{{end}} 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"> <div class="gallery {{ with .Get "class"}}{{.}}{{end}} caption-position-{{ with .Get "caption-position" | default "none" }}{{.}}{{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") -}} {{- with (.Get "dir") -}}
<!-- If a directory was specified, generate figures for all of the images in the directory --> <!-- If a directory was specified, generate figures for all of the images in the directory -->
{{- $files := readDir (print "/static/" .) }} {{- $files := readDir (print "/static/" .) }}
{{- $boxClass := $.Get "boxClass" | default "threeTilesBoxes" }}
{{- range $files -}} {{- range $files -}}
<!-- skip files that aren't images, or that include the thumb suffix in their name --> <!-- skip files that aren't images, or that include the thumb suffix in their name -->
{{- $thumbext := $.Get "thumb" | default "-thumb" }} {{- $thumbext := $.Get "thumb" | default "-thumb" }}
@@ -21,7 +22,7 @@ Documentation and licence at https://github.com/liwenyip/hugo-easy-gallery/
{{- $thumb := .Name | replaceRE "(\\.)" ($thumbext | printf "%s.") }}<!-- filename of thumbnail image --> {{- $thumb := .Name | replaceRE "(\\.)" ($thumbext | printf "%s.") }}<!-- filename of thumbnail image -->
{{- $thumbexists := where $files "Name" $thumb }}<!-- does a thumbnail image exist? --> {{- $thumbexists := where $files "Name" $thumb }}<!-- does a thumbnail image exist? -->
{{- $thumbURL := print $baseURL ($.Get "dir") "/" $thumb | absURL }}<!-- absolute URL to thumbnail image --> {{- $thumbURL := print $baseURL ($.Get "dir") "/" $thumb | absURL }}<!-- absolute URL to thumbnail image -->
<div class="{{ with .Get "boxClass" | default "threeTilesBoxes" }}{{.}}{{end}}"> <div class="{{ $boxClass }}">
<figure itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject"> <figure itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
<div class="img" style="background-image: url('{{ if $thumbexists }}{{ $thumbURL }}{{ else }}{{ $linkURL }}{{ end }}');" > <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 --> <img itemprop="thumbnail" src="{{ if $thumbexists }}{{ $thumbURL }}{{ else }}{{ $linkURL }}{{ end }}" alt="{{ $caption }}" /><!-- <img> hidden if in .gallery -->