We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 336af56 commit db3b32aCopy full SHA for db3b32a
1 file changed
docs/js/home.js
@@ -1,10 +1,12 @@
1
document.addEventListener("DOMContentLoaded", () => {
2
const path = location.pathname;
3
+ const normalizedPath = path.replace(/\/+$/, "") || "/";
4
+
5
if (
- path === "/" ||
- path.endsWith("/index.html") ||
6
- path.match(/\/index\.[a-z]{2}\/?$/)
+ normalizedPath === "/" ||
7
+ normalizedPath === "/index.html" ||
8
+ normalizedPath.match(/^\/index\.[a-z]{2}$/)
9
) {
10
document.body.classList.add("is-home");
11
}
-});
12
+});
0 commit comments