Skip to content

New API for next Hugo version #13776

Open
@bep

Description

@bep
  • Page.Rotate({language,version,role})
  • Site.Dimension{language,version,role})
  • ...

Mount Config

[[module.mounts]]
source = 'content/nn'
target = 'content'
[module.mounts.sites]
languages = ["nn"]
versions = ["**"]
roles = ["**"]

The Glob expressions above uses "." as separator.

Front matter

sites:
   languages: ["**"]
   languageDelegees: ["**"]
   versions: ["**"]
   versionDelegees: ["**"]
   roles: ["**"]
   roleDelegees: ["**"]

Note that this also applies to page metadata set in content adapters.

Content Adapters

Before Hugo v0.148.0 the site matrix had only one dimension, language, and we executed a given _content.gotmpl file with the Site that represented the file's language (configured either in the file name, the mount config or fall back to defaultContentLanguage). You could then invoke .EnableAllLanguages in _content.gotmpl to execute the same template for all Sites/languages.

In v0.148.0 we have 3 dimensions (language, version, role) and a Site is represented by a vector of these 3, e.g. ('en', 'v2.1.0', 'guest'). And since a _content.gotmpl can be configured for e.g. many languages, we, by default, only execute the _content.gotmpl once with the first matching Site. You can override this behaviour by invoking .EnableAllDimensions. But note that you don't need to do that if the goal is just to e.g. create content across languages, since it's now possible to set sites.{languages,versions,roles} as Glob patterns in both the file mount config or in page metadata/front matter.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions