Skip to content

Add support for fixed version module imports in hugo.toml #13964

@bep

Description

@bep

See https://discourse.gohugo.io/t/mounting-different-branches-tags-from-the-same-repository/55849

That discussion isn't new, and looking at it in the light of the upcoming new version and role dimensions in Hugo (in addition to the existing language), having a way to mount multiple minor versions of a module in the same project would be super useful.

I have certainly spent some time thinking about this before, but I suspect I haven't thought "simple" enough.

So, Go Modules support multiple major versions of the same module (e.g. github.com/bep/mymod and github.com/bep/mymod/v2), but I don't think there's a practical way to do multiple minor versions directly with Go Modules.

But I think we could add a concept of fixed version module imports (with a commit hash or a version tag added to the config), so we get:

  1. A set of module imports that follows the version life cycle of Go Modules (with Minimum Version Selection (MVS) and version upgrades via hugo mod get etc.). This is typically the current working branch of content modules you're working on, shortcode/JavaScript/CSS modules etc.
  2. A set of module imports with a fixed version set in hugo.toml. These will not show up in go.mod or go.sum (we probably need to add a hugo.sum for these), and they will not be upgradable via hugo mod get(you need to edit the config), but other than that they should work as the "others" (and we would certainly use Go's tooling to do this).

I will spend a couple of hours tomorrow morning (when my head is fresh) to see if the above is viable.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions