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

Documentation Version Swapping Doesn't work with Chapter Links #161

Open
nicholas-maltbie opened this issue Feb 4, 2023 · 0 comments
Open
Labels
bug Something isn't working documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@nicholas-maltbie
Copy link
Owner

Swapping version with a chapter selected doesn't load the new URL page properly.

Need to patch this behaviour in the main.js script.

Changing version on a page with a chapter selected should result like this:

https://nickmaltbie.com/OpenKCC/docs/manual/introduction.html#why-kinematic

to

https://nickmaltbie.com/OpenKCC/docs/v1.3.0/manual/introduction.html#why-kinematic

but instead results like this

https://nickmaltbie.com/OpenKCC/docs/manual/introduction.html#why-kinematic/../../v1.2.3/

Need to fix it to ignore the chapter tag when computing the new web link in the selectVersion function.

function selectVersion() {
selectedVersion = document.getElementById("version-selector").value
prefix = currentVersion() == "latest" ? "/../" : "/../../"
root = new URL(document.location + prefix + document.querySelector('meta[property="docfx:rel"]').content).href
rootWithVersion = new URL(document.location.href + "/../" + document.querySelector('meta[property="docfx:rel"]').content).href
leaf = window.location.href.substring(rootWithVersion.length)
versionPath = selectedVersion == "latest" ? "" : selectedVersion + "/"
window.location.href = root + versionPath + leaf
}

@nicholas-maltbie nicholas-maltbie added bug Something isn't working documentation Improvements or additions to documentation good first issue Good for newcomers labels Feb 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant