Closed iammatthias closed 6 years ago
Away from my personal computer at the moment, so I haven't been able to test this yet. Is this functionality that could be achieved with the Hugo 'Delimit' function?
~~+++ title: Delimit galleries
+++~~
Then use {{< gallery dir="/img/{{ delimit .Params.gal }}" />}} {{< load-photoswipe >}}
?
Edit: didn't work. At a loss for this.
Tried modifying the Gallery shortcode, but it either loads a blank page, or causes an error when building.
Any advice? Would really love to get the galleries working soon.
You need to do something like:
{{- with (.Get "dir") -}}
<!-- If a directory was specified, generate figures for all of the images in the directory -->
{{- $subdirs := readDir (print "/static/" .) }} <!-- new line of code -->
{{- range $subdirs }} <!-- new line of code -->
{{- $files := readDir . }} <!-- modified line of code -->
{{- range $files -}}
Don't forget to add a {{- end }}
to close off the range
function.
Is it possible to create a "master gallery" of all images in subfolders? I'd like to have one gallery that includes everything, and then multiple sub-galleries.
My images are organized within the
img
folder like so:Is there a way to target all of those at once with the Gallery shortcode? Something like
{{< gallery dir="/img/**/**/" />}} {{< load-photoswipe >}}
?Edit: I am using the Victor-Hugo boilerplate, if that has anything to do with it.
Folder structure is:
All static assets are in
/static/img/
which builds to./img/
Master gallery example (not working): https://staging.iammatthias.com/gal/ Individual gallery example (working): https://staging.iammatthias.com/gal/flatframe