From 282004c72a56f19133fce5966ac557f73dfe59e1 Mon Sep 17 00:00:00 2001 From: ktmouk Date: Fri, 6 Oct 2023 19:24:19 +0900 Subject: [PATCH] Fix the sidebar not desplayed when the path contains /locale (#20030) Co-authored-by: Joshua Wehner --- app/javascript/packs/homePage.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/javascript/packs/homePage.jsx b/app/javascript/packs/homePage.jsx index 7ea4ce50d..2ec4ddde6 100644 --- a/app/javascript/packs/homePage.jsx +++ b/app/javascript/packs/homePage.jsx @@ -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 (