Fix version control with anchors (#10595)

* Fix version control with anchors

* Simplify
This commit is contained in:
Sylvain Gugger
2021-03-08 10:19:22 -05:00
committed by GitHub
parent f882966004
commit 5469369480

View File

@@ -128,7 +128,7 @@ function addVersionControl() {
const parts = location.toString().split('/');
let versionIndex = parts.length - 2;
// Index page may not have a last part with filename.html so we need to go up
if (parts[parts.length - 1] != "" && ! parts[parts.length - 1].match(/\.html$|^search.html?/)) {
if (parts[parts.length - 1] != "" && ! parts[parts.length - 1].match(/\.html/)) {
versionIndex = parts.length - 1;
}
// Main classes and models are nested so we need to go deeper