Skip to content

Add {language,version,role}Delegees to front matter #13680

Open
@bep

Description

@bep

This idea springs out of my work in #13679.

We have template func that kind of does this for languages, but it's hard to use beyond the simplest of use cases.

With the addition of roles and version as new dimensions to the Hugo build matrix, I though we could end up with something ala this front matter:

title: My Post
languages: ["sv", "no"]
languageDelegees: ["*", "! jp"]
versions: ["v2.0.0"]
versionDelegees: ["v2*"]

Etc.

In the above:

  • languages: ["sv", "no"] means that this will be rendered for both sv, no, you will get one page in each language, two URLs.
  • languageDelegees: ["*", "! jp"] means that we pick the first1 matching delegee page. This means that for e.g. site.RegularPages you may get a pointer to a Page in another site.

It would obviously be useful if we could set these values (e.g. both versions and versionDelegees) in the cascade configuration, but that will be limited to the configuration file (e.g. hugo.toml), as we need these values early.

Footnotes

  1. Closes match in the sort order of the {languages,versions,roles} with a preference to matches above (e.g. a newer version).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions