Lightgallery configuration & features

Features

Configuration

Lightgallery can be configured in two ways:

Global defaults

# those are the default values which are used if you don't specify them
[params.lightgallery.defaults]
  speed = 500
  thumbformat = "webp"
  thumbquality = "q70"
  thumbsize = "200x200"
  thumbtype = "fit"         # fit | fill, see example post for difference
  transition = "lg-slide"   # PROBABLY BROKEN, DON'T CHANGE

If you specify those values also in the shortcode, the latter has precedence.

Shortcode configuration

You can use all parameters in the shortcode which you can set in defaults.

There are three ways to invoke lightgallery:

{{< lightgallery glob="GLOB_EXPRESSION"  >}}    # images from page bundle
{{< lightgallery assets="GLOB_EXPRESSION" >}}   # images from assets/ dir
{{< lightgallery >}}                            # ALL images from page bundle

And one additional parameter:

{{< lightgallery altslice=NUMBER >}}

Parameter altslice

Sometimes you want image captions. You can have them. Lets’s assume you have the following image files in your page bundle:

index.md
images/
   image1 a horizon.jpg
   image2 me against the horizon.jpg
   image3 the dark valley behind me.jpg

Normally the file name is the image caption. Now if you have a constant part in front of the file name (in this case: imageX) you can remove it with altslice.

So {{< lightgallery altslice=6 >}} uses the file name as caption, but removes the first six chars, which will give you these image captions: