Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tag versions and hugo modules #64

Closed
aljaznuncic opened this issue Nov 3, 2023 · 8 comments
Closed

Tag versions and hugo modules #64

aljaznuncic opened this issue Nov 3, 2023 · 8 comments
Assignees

Comments

@aljaznuncic
Copy link

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

@mfg92 mfg92 self-assigned this Nov 3, 2023
@mfg92
Copy link
Owner

mfg92 commented Nov 3, 2023

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.

@sheldonhull
Copy link

sheldonhull commented Nov 4, 2023

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

@mfg92
Copy link
Owner

mfg92 commented Nov 5, 2023

I have added the "v", can you try again?

@josephbadow
Copy link

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/[email protected]
github.com/jpanther/congo github.com/mfg92/[email protected]

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.)

@mfg92
Copy link
Owner

mfg92 commented Feb 12, 2024

@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!

@josephbadow
Copy link

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/[email protected]
github.com/jpanther/congo github.com/mfg92/[email protected]

# 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/[email protected]/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 (gohugoio/hugo#11558, golang/go#61888). It doesn't affect my page and the one gallery I have is still behaving as expected.

@mfg92
Copy link
Owner

mfg92 commented Feb 26, 2024

That warning is now fixed thanks to #69.

@mfg92
Copy link
Owner

mfg92 commented Feb 26, 2024

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.

@mfg92 mfg92 closed this as completed Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants