How to maintain links in versioned subtrees

We’d like to put a huge software documentation into versioned subdirectories,


All content below would be copied from one release to the next, in order to avoid any dependence between releases. Within each release tree, we have numerous internal links. We prefer absolute paths over relative paths because pages may be moved to different hierarchy levels.
Question: How to write links to content/documentation/current/A/B/ such that they can easily replaced by content/documentation/$release/A/B/ whenever a new release is published.

Have a look at the ref shortcode:

ref works with either relative or absolute paths. Relative paths are inconvenient because the location from there they are called may change. Absolute paths are inconvenient because they would contain the version number or “current”.
One possible solution: absolute paths that contain a version function. How to write such a function that detects the version part of the absolute path the calling page is located in?

From within the shortcode, you have access to the .Page calling it, which gives you the .Rel/Permalink values for the calling page.

Then you can use the split function: to split at /s.

Then you can perform your checking / matching logic.

Would be easier to help with actual code to test with.

Thanks. I’ll take this as the solution, and come back with actual code if I need more help.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.