automatically detect if source is a folder

This commit is contained in:
2024-02-05 14:29:37 +01:00
parent 0a778ee8e9
commit 3dde053bca
2 changed files with 27 additions and 17 deletions

View File

@@ -14,7 +14,7 @@ Automagical css image gallery in [Hugo](https://gohugo.io/) using shortcodes. Li
- **slideshow** displaying only one image at a time with the ability to navigate
- **gallery** displaying all selected pictures next to each other
- All pictures can be expanded on click in a lightbox
- Manually select the images you want to display, or provide the path to a directory to use all images inside
- Manually select the images you want to display, or provide the path to a directory to use all images inside. This can be combined!
- Next/prev buttons in slideshow and lightbox views
- The gallery is responsive, images are scaled/cropped to fill 16:10 tiles
- CSS and JS is automatically loaded the first time you use the `{{< snap-gallery >}}` shortcode on each page
@@ -25,8 +25,6 @@ Automagical css image gallery in [Hugo](https://gohugo.io/) using shortcodes. Li
- Captions / title
- Alternative text
- Automatically detect whether source is an image or directory
- Support a micture of dirs and single images
## Installation
@@ -42,13 +40,12 @@ theme = [ "hugo-sustain", "hugo-snap-gallery" ]
Quickstart:
- `{{< snap-gallery src="image1.jpg, image2.png" >}}`: Display these two images in **gallery** mode
- `{{< snap-gallery src="image1.jpg image2.png" mode="slideshow" >}}`: Display these two images in **slideshow** mode
- `{{< snap-gallery src="img/page1" isdir=true >}}`: Display all images in the folder `img/page1` in **gallery** mode
- `{{< snap-gallery src="image1.jpg, image2.png" mode="slideshow" >}}`: Display these two images in **slideshow** mode
- `{{< snap-gallery src="img/folder1/, image2.png" >}}`: Display all images in the directory `img/folder1` and the single image `image2.png` in **gallery** mode
All parameters:
- `src`: Must contain either a comma-separated list of paths to images, or a directory path containing images.
- `isdir`: Whether `src` contains one or multiple individual images, ow a whole directory. Default: `false`.
- `lightbox`: Whether a click on an image shall open a lightbox modal. Default: `true`.
- `mode`: Can be either `gallery` or `slideshow`. Default: `gallery`.
- For gallery mode: