How to specify the version of third parties library?

Hi, I want to specify the version of third-party library in Hugo module, for example,

path = ""

path = ""
source = "svgs/brands"
target = "assets/icons/font-awesome-brands"
source = "svgs/regular"
target = "assets/icons/font-awesome-regular"
source = "svgs/solid"
target = "assets/icons/font-awesome-solid"

I want to specify the versions like NPM does: ^5.0.0 || ^6.0.0, since the module doesn’t work with 4.
And then throw an error if users install the wrong version.

This will download the latest 6.x version

@divinerites logged this a while ago…

1 Like

Maybe there’s another way, but you can work around the Font Awesome tagging issue by forking.

1) Visit


2) Press the Fork button.


3) Press the Create fork button.

4) Clone the new repository, something like:

cd $HOME/code
git clone
cd Font-Awesome

5) When you cd into the directory, you will be on the 6.x branch.


6) Initialize as a Go module, ending with /v6, something like:

go mod init

7) Commit the change, tag, and push back to your fork:

git add go.mod
git commit -m "Initialize Go module"
git tag v6.2.1
git push
git push --tags

8) In your Hugo site configuration, import the new module (note the /v6 at the end), something like:

path = ""

9) If you have been testing, clear the caches:

# The command below is irreversible! Make sure you don't delete /tmp.
sudo rm -rf /tmp/hugo-cache
go clean -modcache

10) Build your site and examine the go.mod file. It should look something like:

module mysite

go 1.19

require ( v6.2.1 // indirect v0.1.0 // indirect

I’ll leave the repository in place for a couple of days if you want to test with it, but I’m deleting it on 14 December 2022.


Thanks, but it may be hard to maintain and keep the fork up to date in this way.

First, it really doesn’t change that often. They are just icons.

Second, GitHub makes it simple with the Sync fork button on your forked repo:


1 Like

Thanks, it seems the better way so far. I think the re tag task can be done automatically via GitHub Actions (schedule), so that it won’t become a problem.

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