Closed aljaznuncic closed 8 months ago
Good point @aljaznuncic. I have now finally released version 1.0.0 of hugo-shortcode-gallery. Can hugo-shortcode-gallery actually be used as a hugo module now? I have not used any hugo modules for my own website, so I am a newbie in this area. I did a quick search and it seems that at least a hugo.yaml file is needed in hugo-shortcode-gallery to make it work as a hugo module. Can you give me any feedback on this? A PR is also very welcome.
Go based tagging scheme requires v
prefix in the tag name and since adding a new module is using hugos version of go mod I believe, not sure it will work without that prefix. Will give it a shot.
trying hugo mod get github.com/mfg92/hugo-shortcode-gallery@latest
and will see how this works.
It does, pulling the master commit. The tag won't work as I thought without using v
in the tagging scheme due to Go's idioms.
$ hugo mod get github.com/mfg92/hugo-shortcode-gallery@latest
go: downloading github.com/mfg92/hugo-shortcode-gallery v0.0.0-20231103123849-a02ed1699264
go: added github.com/mfg92/hugo-shortcode-gallery v0.0.0-20231103123849-a02ed1699264
I have added the "v", can you try again?
Let's warm this up, I'm interested as well. I just tested it on my machine, but I have no experience with hugo modules so far. Here is what I did:
Remove theme reference from my config. In my case that means removing the whole line
theme = ["hugo-shortcode-gallery"]
I also renamed the folder themes/hugo-shortcode-gallery
for good measure.
Adding hugo-shortcode-gallery as new item in module.imports
[[imports]]
path = "github.com/mfg92/hugo-shortcode-gallery"
"Downloading" the module
hugo mod get github.com/mfg92/hugo-shortcode-gallery@latest
Now, when I run hugo mod graph
I see both modules:
hugo mod graph
github.com/jpanther/congo github.com/jpanther/congo/v2@v2.8.0
github.com/jpanther/congo github.com/mfg92/hugo-shortcode-gallery@v1.0.0
Running hugo
simply renders everything without errors. I only have one post with the gallery so far, so there is not much that I can test at the moment. (I'm using the congo theme, as you can see.)
@josephbadow I have finally set up hugo-shortcode-gallery as a Hugo module. Could you please test it to ensure it works as expected? Although it worked on my end, it would be great to have another perspective :)
I have created a release wit this change: v1.1.0
Feel free to share your thoughts on the updated README.md too. Thank you!
I started by updating my modules (I think that command is currently missing in your readme) and that worked flawlessly.
# Displaying currently installed modules
$ hugo mod graph
github.com/jpanther/congo github.com/jpanther/congo/v2@v2.8.0
github.com/jpanther/congo github.com/mfg92/hugo-shortcode-gallery@v1.0.0
# Updating modules
$ hugo mod get -u
go: downloading github.com/mfg92/hugo-shortcode-gallery v1.1.0
go: upgraded github.com/mfg92/hugo-shortcode-gallery v1.0.0 => v1.1.0
# Building pages
$ hugo
WARN Failed to read module config for "github.com/mfg92/hugo-shortcode-gallery" in "/home/joseph/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/mfg92/hugo-shortcode-gallery@v1.1.0/theme.toml": "_stream.toml:8:20": unmarshal failed: toml: float can have at most one decimal point
Start building sites …
hugo v0.122.0-b9a03bd59d5f71a529acb3e33f995e0ef332b3aa+extended linux/amd64 BuildDate=2024-01-26T15:54:24Z VendorInfo=snap:0.122.0
| EN
-------------------+------
Pages | 100
Paginator pages | 5
Non-page files | 31
Static files | 24
Processed images | 214
Aliases | 35
Sitemaps | 1
Cleaned | 0
Total in 449 ms
I received a warning during build, which I saw at other points as well (https://github.com/gohugoio/hugo/issues/11558, https://github.com/golang/go/issues/61888). It doesn't affect my page and the one gallery I have is still behaving as expected.
That warning is now fixed thanks to #69.
I have incorporated your feedback about the readme in the latest commit. I will close this issue now. If you have any problems, feel free to post here or open a new issue.
It will be very good, if we start versioning code with tags, so we can use this shortcode with hugo modules: https://gohugo.io/hugo-modules/use-modules/#get-a-specific-version