Skip to content

Conversation

@stockholmux
Copy link
Contributor

Issue number:

Closes # n/a

Description of changes:

Currently, you can supply latest and a # to get a context aware forward to the latest version.

So, for example:
/en/os/latest#/install/quickstart/aws/host-containers/ would link to /en/os/1.19.x/install/quickstart/aws/host-containers/ and in the future /en/os/1.20.x/install/quickstart/aws/host-containers/ (and so on).

However, this doesn't work if you need to deep link to an anchor (e.g. URLs with #).

/en/os/latest#/install/quickstart/aws/host-containers/#prerequisites forwards to /en/os/1.19.x/ (because it can't figure out a correct page and fails back to the most recent version).

This commit adds additional logic to look for an additional # (the last one). If present, it uses what's before the last # as the page and everything afterwards is appended to the end of the URL.

Consequently:
/en/os/latest#/install/quickstart/aws/host-containers/#prerequisites forwards to /en/os/1.19.x/install/quickstart/aws/host-containers/ and jumps the page to #prerequisites

Additionally, /en/os/latest#/install/quickstart/aws/host-containers/ still forwards to /en/os/1.19.x/install/quickstart/aws/host-containers/ .

If you supply it with multiple hashes the script still preserves the existing behaviour of falling back to the version directory (e.g./en/os/latest#/install/quickstart/aws/host-containers/#foo#prerequisites will just go to /en/os/1.19.x/).

Terms of contribution:

By submitting this pull request, I confirm that my contribution is made under
the terms of the licenses outlined in the LICENSE-SUMMARY file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant