A quick image gallery for Hugo
Here's a quick image gallery that can read a folder and generate a quick gallery.
It will try to load all JPG files in the provided path, and assumes that every image has a thumbnail file that has the -thumb.EXT
extension. Ex: for a file 'blah.jpg', it would assume there would also be a 'blah-thumb.jpg'.
Drop this into layouts/shortcodes/foldergallery.html
:
Once that's done add this javascript to your installation somewhere:
|
|
The shortcode assumes that galleries are stored in folders under the /static path.
Here's an example of how to use it:
{{< foldergallery src="images/galleries/2015/" >}}
Generating thumbnails
Here's how I do it in Linux (might also work on Mac with homebrew). First, install imagemagick. I store my galleries under static/images/galleries/<GALLERYNAME>
. To create thumbnails for all my galleries:
|
|
Repeat this for each file format you want thumbnails for (this will only convert jpegs).