Skip to content

Add roles and versions as new dimensions (in addition to language) #13679

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

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

bep
Copy link
Member

@bep bep commented May 1, 2025

The implementation here is still early and non-working. So, the role part of this has been thought about a lot (at least by me, e.g. in #519). The versions part of this is a little vaguer, but I think it helps with the end result to add them both in one go.

So,

---
title: Hugo Rocks!
roles: [public]
versions: [v1.2.3, `v2.*`]

Note that the Glob pattern support in v2.* is also new – but I suspect we will need something like that for this.

As for languages, it will be possible to configure a role/version as the default (e.g. the "current version"). I guess it also makes sense to control whether the default should be rendered to a sub folder or not.

As to the order of the prefixes, role needs to come first, I guess.

  • I guess we will also add versions and roles to the file mount config.
  • I'm thinking we could also add some kind of "counter identifier" in content filenames, e.g. content/mybundle/index.§1.md and content/mybundle/index.§2.md to allow having multiple variants of the same content path.

New API

  • Site.Version; a struct with Name, Site ...
  • site.Versions; a slice of Version. Ordered by Weight (if set) ascending, else semver order, newest first.
  • Site.Role; a struct with Name, Site ...
  • site.Roles; a slice of Role.

Note that we currently have Site.Sites, which is, with the above setup coming, a little confusing, so we should possibly also consider to add Site to `Language.

New Config

I've thought about this, and decided to not make up any new clever syntax, but just mimic how we do it for languages.

defaultContentRole = "guest"
defaultContentRoleInSubdir = true
defaultContentVersion = "v2.0.0"
defaultContentVersionInSubdir = true

[roles]
[languages."guest"]
disabled = false
weight = 43
[versions]
[versions."v2.0.0"]
disabled = false
weight = 42

@bep bep force-pushed the feat/roles-versions-5139 branch from b138f82 to dcc6032 Compare May 4, 2025 13:41
@bep bep force-pushed the feat/roles-versions-5139 branch from dcc6032 to bac0ff6 Compare May 4, 2025 15:45
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

Successfully merging this pull request may close these issues.

1 participant