Fix the sidebar not desplayed when the path contains /locale (#20030)

Co-authored-by: Joshua Wehner <joshua@forem.com>
This commit is contained in:
ktmouk 2023-10-06 19:24:19 +09:00 committed by GitHub
parent 2a489210a2
commit 282004c72a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -63,9 +63,13 @@ function trackTagCogIconClicks() {
});
}
function removeLocalePath(pathname) {
return pathname.replace(/^\/locale\/[a-zA-Z-]+\/?/, '/');
}
function renderSidebar() {
const sidebarContainer = document.getElementById('sidebar-wrapper-right');
const { pathname } = window.location;
const pathname = removeLocalePath(window.location.pathname);
// If the screen's width is less than 640 we don't need this extra data.
if (