Add addSplatAlias method to ContentCatalog
Antora creates splat aliases internally to support the latest version segment. However, the logic to set up this resource is not exposed. Therefore, an extension creator is required to emulate this logic to get the same result. The ContentCatalog object should provide a method named addSplatAlias
that handles setting up this resource.
The signature of the method should be as follows:
addSplatAlias(fromSrc, toSrc)
where fromSrc and toSrc are defined as:
{ component, version = undefined, versionSegment }
If versionSegment is not specified, it is looked up using getComponentVersion(component, version).activeVersionSegment
(though it probably should always be specified). If version is not specified, the versionSegment value is used.
The version is only relevant for the toSrc. Due to restrictions in how the virtual file system is organized, the fromSrc.versionSegment is used as the version on the (from) alias.
Here's an example of the virtual file it produces:
src: {
component: 'productname',
version: 'awesomest',
module: 'ROOT',
family: 'alias',
relative: '',
},
pub: {
url: '/productname/awesomest/',
splat: true,
},
rel: {
src: {
component: 'productname',
version: '3.2',
module: 'ROOT',
family: 'alias',
relative: '',
},
pub: {
url: '/productname/latest/',
splat: true,
}
}
This also honors the contract and is related to #1007 (closed).
This issue was updated to change the method name from registerSplatAlias
to addSplatAlias
.