gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
76.2k stars 7.55k forks source link

Add a BRANCH parameter when importing a git module in config/_default/hugo.toml #11928

Open vinceyoumans opened 10 months ago

vinceyoumans commented 10 months ago

Use of MODULES hosted on Git repos is an awesome feature. For example...

[[module.imports]]
    # path = 'github.com/bingo/tl01-bigme-content@v02'
    path = 'github.com/bingo/tl01-bigme.com-content'
    # branch = 'v02'.   BRANCH will always be MAIN.  not an option to pick branch in hugo config
    # branch = 'main'
    [[module.imports.mounts]]
      # source = "v02/content/en"
      source = "v03/content"
      target = "content"

In this code snip, content is maintained separately but still mounted.

PROBLEM

Only the MAIN branch of the above CONTENT repo in imported. The

branch = 'main'.

does nothing. But It would be very cool if we could include BRANCH into the Path.

I would be very happy to do this feature if I can get some feed back on what would need to be done or if I am missing something.

cheers

jmooring commented 10 months ago

After the initial import, you can:

hugo mod get github.com/foo/bar@somebranch

But it would be convenient to handle that in config.

bep commented 10 months ago

I agree that it would be useful, but I'm not sure how simple it is to implement. The operations we do on regular Hugo builds are, I think:

Both of the above operates on the content of your go.mod/work file(s).