Light Gallery as a Hugo Module

Cheers! I’m having a bit of trouble trying to use LightGallery as a Hugo module. What I’ve added the following to the config:

module:
  imports:
    - path: "github.com/sachinchoolur/lightgallery"
      mounts:
        - source: "dist"
          target: "assets/lightgallery"

The problem: Hugo fetches the wrong version from the repository. The latest release is 2.4.0, but Hugo is fetching version 1.1.3. I’m not completely sure why that is happening. I can force Hugo to fetch the latest version (or at least a newer version, not sure if it’s the latest…) through the command line like this:

hugo mod get github.com/sachinchoolur/lightGallery@2.4.0

or

hugo mod get github.com/sachinchoolur/lightGallery@master

But when I simply use hugo mod get to automatically fetch all the imports, it fetches the outdated version. Any way to solve this?

Go Modules (which Hugo Modules is built upon) is not very lenient when it comes to version tags. It works on tags on the form v1.0.0 (note the v prefix), and I guess v1.1.3 is the last version on that form.

There is a story beyond this, however, and that is the handling of major version increments.

The short story is that for repos that you don’t control which does not follow the above versioning scheme, your best bet os to use the method you already have found.

I see. Thanks for the answer!

Just a word of caution: In its current state, LightGallery does not allow for a useful CSP since it’s inserting raw HTML without any safeguards. This does not impede its functionality, but if you want to have a reasonable CSP, you’ll probably have to wait for a fix.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.