Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds hash/latest functionality #435

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

stockholmux
Copy link
Member

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