From 6ae6c9daccddbead2894a1b158252342a8e7864a Mon Sep 17 00:00:00 2001 From: Ming Di Leom <2809763-curben@users.noreply.gitlab.com> Date: Mon, 27 Jun 2022 12:48:17 +0000 Subject: [PATCH] fix(js): avoid removing homepage link - to avoid removing .onion from homepage --- themes/chameleon/source/js/chameleon.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/themes/chameleon/source/js/chameleon.js b/themes/chameleon/source/js/chameleon.js index 8be5c8b..0663e15 100644 --- a/themes/chameleon/source/js/chameleon.js +++ b/themes/chameleon/source/js/chameleon.js @@ -60,7 +60,8 @@ if (document.location.hostname.endsWith('.onion')) { const navLink = document.querySelectorAll('a.main-nav-link, a.mobile-nav-link-a') navLink.forEach((ele) => { const eleHref = new URL(ele.href) - if (eleHref.pathname === document.location.pathname) { + const docPath = document.location.pathname + if (eleHref.pathname !== '/' && eleHref.pathname === docPath) { const span = document.createElement('span') span.className = ele.className span.textContent = ele.textContent