Skip to content

Commit db3b32a

Browse files
committed
fixed index.en pages background
1 parent 336af56 commit db3b32a

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

docs/js/home.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
document.addEventListener("DOMContentLoaded", () => {
22
const path = location.pathname;
3+
const normalizedPath = path.replace(/\/+$/, "") || "/";
4+
35
if (
4-
path === "/" ||
5-
path.endsWith("/index.html") ||
6-
path.match(/\/index\.[a-z]{2}\/?$/)
6+
normalizedPath === "/" ||
7+
normalizedPath === "/index.html" ||
8+
normalizedPath.match(/^\/index\.[a-z]{2}$/)
79
) {
810
document.body.classList.add("is-home");
911
}
10-
});
12+
});

0 commit comments

Comments
 (0)