From 3260b52c47c1317c04db9c92e8cfae3963bbb2b0 Mon Sep 17 00:00:00 2001 From: sigoden Date: Sun, 19 Jun 2022 22:22:49 +0800 Subject: [PATCH] chore: fix breadcrumb --- assets/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/assets/index.js b/assets/index.js index c447407..e09671c 100644 --- a/assets/index.js +++ b/assets/index.js @@ -132,11 +132,14 @@ function addBreadcrumb(href, uri_prefix) { parts = href.split("/"); } const len = parts.length; - let path = uri_prefix.slice(0, -1); + let path = uri_prefix; for (let i = 0; i < len; i++) { const name = parts[i]; if (i > 0) { - path += "/" + encodeURI(name); + if (!path.endsWith("/")) { + path += "/"; + } + path += encodeURI(name); } if (i === 0) { $breadcrumb.insertAdjacentHTML("beforeend", ``);