bglug.it/layouts/shortcodes/foldergallery.html
omartek 1ac83d8859
All checks were successful
Container Publish / build-image (push) Successful in 10m8s
Galleria foto con fancybox: scaricato assets (#131)
Ho eliminato la cartella con le foto doppione e scaricato gil assets nella cartella static/assets/. Per metterli nella cartella assets/ [serve scrivere altro]([url](https://digitaldrummerj.me/hugo-asset-pipeline/)), non so se ne vale la pena.

Reviewed-on: #131
Co-authored-by: omartek <olazzari@gmail.com>
Co-committed-by: omartek <olazzari@gmail.com>
2024-07-21 16:35:23 +00:00

46 lines
1.3 KiB
HTML

<!-- /layouts/shortcodes/foldergallery.html -->
<style>
div.gallery {
display: flex;
flex-wrap: wrap;
}
div.gallery a {
flex-grow: 1;
object-fit: cover;
margin: 2px;
display: flex;
}
div.gallery a img {
height: 200px;
object-fit: cover;
flex-grow: 1;
}
</style>
<!-- 3.7.1 integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo="-->
<!-- 3.6.0 integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="-->
<script src="/js/jquery.min.js"></script>
<script src="/js/jquery.fancybox.3.5.7.min.js"></script>
<link rel="stylesheet" href="/js/jquery.fancybox.3.5.7.min.css" />
<div class="gallery">
{{ $path := print "content/gallery/" (.Get "src") }}
{{ $url := print (.Get "src") }}
{{ range (readDir $path) }}
{{/* don't try to display .DS_Store or directories */}}
{{ if and (ne .Name ".DS_Store") (not .IsDir) }}
{{ $src := print "/it/gallery" "/" $url "/" .Name }}
{{/*
troubleshoot the $src variable as needed
<!-- <p>{{ $src }}</p> -->
*/}}
<a data-fancybox="gallery" data-caption="{{ .Name }}" href="{{ $src }}">
<img src="{{ $src }}"> <br/>
</a>
{{ end }}
{{ end }}
</div>