Skip to content

Commit eaaba61

Browse files
Modified URL Modification Condition
1 parent 5ad9c4a commit eaaba61

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

script.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
var currentUrl = window.location.href;
22
var newUrl = currentUrl;
33

4-
if (currentUrl.endsWith("index.html") || currentUrl.endsWith("index")) {
5-
newUrl = currentUrl.replace(/index\.html$|index$/, '');
6-
} else if (window.location.pathname.endsWith(".html")) {
7-
newUrl = currentUrl.replace(/\.html$/, '');
8-
}
4+
if (currentUrl.includes("github.io")) {
5+
if (currentUrl.endsWith("index.html") || currentUrl.endsWith("index")) {
6+
newUrl = currentUrl.replace(/index\.html$|index$/, '');
7+
} else if (window.location.pathname.endsWith(".html")) {
8+
newUrl = currentUrl.replace(/\.html$/, '');
9+
}
910

10-
if (newUrl !== currentUrl) {
11-
window.history.replaceState(null, null, newUrl);
11+
if (newUrl !== currentUrl) {
12+
window.history.replaceState(null, null, newUrl);
13+
}
1214
}
1315

14-
1516
const typedTitle = document.getElementById('typed-text');
1617
const typedDescription = document.getElementById('typed-description');
1718
const buttons = document.querySelector('.buttons');

0 commit comments

Comments
 (0)