Allow a component to be promoted to the site root
There are two goals we want to accomplish:
- Provide a start page / entry point for the site
- Hide the component folder for a component, often when the site only has a single component
Add configuration to the playbook that allows a component to be promoted to the root of the site. This simply means that the path segment for the component is dropped from the URL. In other words, /my-component/index.html becomes /index.html. We'll call this the site component.
NOTE: None of the source-to-source references to this component change. This only affects how the publication URL is computed.
The proposed configuration is as follows:
site:
component: my-component
The only caveat is that, in order for the site component to occupy the root of the site, it must be versionless (or have a versionless entry). Otherwise, /my-component/1.0/index.html just becomes /1.0/index.html. To solve this problem, we may also allow the version to be specified:
site:
component: 1.0@my-component
In this case, /my-component/1.0/index.html would become /index.html. So it's really promoting a single component version. But what about the other versions of that component? Do they get promoted at all?
Another way to think about it is to have a start page for the site, which defaults to the start page for the greatest version of the site component. In other words:
site:
component: my-component
# if not defined here, use the start page for the greatest version of site component
start_page: 1.0@my-component::index.adoc
So when the visitor navigates to the docs domain, the visitor is redirected automatically to the start page (/index.html -> /1.0/index.html).