Table of Contents
This site supports documentation versioning. All links within the documentation are rendered automatically.
Each documentation module manages its versions in its own docs/data/versions.yml file.
The structure is the same for all modules, but the top-level key must match the module name.
In the current repository, versions are defined under the docs key:
docs:
- version_id: "1"
label: 1.9.0
content_path: docs
route_url: docs
is_main: true
switcher:
visible: false
item_visible: false
- version_id: "2"
label: 2.0.0
content_path: docs/2
route_url: docs/2
switcher:
visible: false
item_visible: falseIn the validation repository:
validation:
- version_id: "2-0-0-snapshot"
label: 2.0.0-SNAPSHOT
content_path: docs/validation
route_url: docs/validation
is_main: true
switcher:
visible: false
item_visible: false
- version_id: "2-0-x"
label: 2.0.x
content_path: docs/validation/2-0-x
route_url: docs/validation/2-0-x
switcher:
visible: false
item_visible: falseWhere:
version_id– a major or minor version identifier used to generate the correct side navigation structure.label– the full version label displayed in the version switcher and available via the{{< version >}}shortcode.content_path– the relative path (from thecontent/directory) to the documentation files for this version.route_url– the base URL used when generating internal links within this documentation version.is_main– optional flag indicating that this version is the main documentation version.switcher:visible– specifies whether the version switcher will be visible on the page.item_visible– specifies whether the version will be available in the switcher dropdown.
The documentation content should be placed under content/docs/<version_id>/ directory.
For the main version, content can either be under its version directory or at
the root – this is controlled by the content_path.
For example if the main version is in the root:
content
└── docs
├── client-libs
├── quick-start
├── _index.md
└── 2
├── client-libs
├── quick-start
└── _index.md
In the validation repository:
content
└── docs
└── validation
├── client-libs
├── _index.md
└── 2-0-x
├── client-libs
└── _index.md
Each version should have its own sidenav configuration file, located either in:
data/docs/<version_id>/sidenav.ymlfor this repository;data/docs/<module>/<version_id>/sidenav.ymlfor documentation modules in their corresponding repositories.
- Create a new directory for the documentation inside the
content/docs/<new-version>/. - Create the
sidenav.ymlinsidedata/docs/<new-version>/directory. - Add the new version to
data/versions.ymlconfig.
This flow applies to the current documentation repository. For modules, the same steps must be done in the corresponding repository using the appropriate paths for that module.
This example shows how to switch from version 1 to version 2.
The current main version can be located either in the root folder or in its
versioned folder and configured via module.mounts.
-
If the main version is in the root, we also need to manually adjust folder structures and move:
content/docs/*->content/docs/1/content/docs/2->content/docs
-
Update the version configuration in
docs/data/versions.yml:docs: - version_id: "1" label: 1.9.0 content_path: docs # Change the path from `docs` to `docs/1`. route_url: docs # Change the route from `docs` to `docs/1`. is_main: true # Change the flag to `false` or delete the line. switcher: visible: false item_visible: false - version_id: "2" label: 2.0.0 content_path: docs/2 # Change the content path to `docs` if the documentation will be copied to the root. route_url: docs/2 # Change the route from `docs/2` to `docs`. is_main: false # Set `is_main` as `true`. switcher: visible: false item_visible: false
Now the version 2 will be available at the https://spine.io/docs/ URL.
Get updates into the main website:
- Go to the
SpineEventEngine.github.iorepository. - Get theme updates
hugo mod get -u github.com/SpineEventEngine/documentation/docs.
All URLs inside content/docs/<version_id>/ are automatically managed
according to the current documentation version.
Use links in documentation as follows, without including a version.
For this repository: [Requirements](docs/guides/requirements/).
In the validation repository: [Requirements](docs/validation/guides/requirements/).
Please note:
- All internal links must not start with a slash.
- Each link should end with a slash to prevent unnecessary redirects.
The link above will be automatically rendered as:
"<baseurl>/docs/guides/requirements/"– for main version."<baseurl>/docs/2/guides/requirements/"– for the version2."<baseurl>/docs/3/guides/requirements/"– for the version3."<baseurl>/docs/validation/guides/requirements/"– for main version."<baseurl>/docs/validation/2-0-x/guides/requirements/"– for the version2-0-x.
To render the current documentation full version inside API URL,
use {{% version %}} shortcode:
[Introduction](docs/{{% version %}}/)
[Hello World v{{% version %}}]({{% get-site-data "repositories.examples" %}}/hello/)Will be rendered as:
<a href="/docs/1.9.0/">Introduction</a>
<a href="https://github.com/spine-examples/hello/" target="_blank">Hello World v1.9.0</a>Where:
- {{% get-site-data "repositories.core_jvm_repo" %}} will apply the
core_jvm_repofrom thesite-commons->data/repositories.ymlfile. - {{% version %}} adds the version label of the current page ->
1.9.0, or2.0.0.
To use a specific version for example in FAQ or Release Notes, provide the version_id:
{{% version "1" %}}It will always render the latest “full” label version of 1, for example now it is 1.9.0.