Skip to content

Commit 01aac6f

Browse files
committed
fix 404.html
1 parent aac2013 commit 01aac6f

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

.github/workflows/gh-pages.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ jobs:
5050
// Find the subroute root from the current URL. Just the pattern components/pr-preview/pr-<PR_NUMBER>
5151
const parts = window.location.pathname.split('/');
5252
let realUrl;
53-
if (parts[1] === 'pr-preview')) {
54-
realUrl = '/' + parts.slice(0, 4).join('/') + '/';
53+
if (parts[2] === 'pr-preview') {
54+
realUrl = '/' + parts.slice(1, 4).join('/') + '/';
5555
} else {
5656
// If not a PR preview, redirect to the main page
57-
realUrl = parts.slice(0, 4);
57+
realUrl = '/' + parts.slice(1, 4).join('/');
5858
}
5959
// Manually fetch the index.html file from the correct subroute
60-
fetch(realUrl + 'index.html')
60+
fetch(realUrl)
6161
.then(response => {
6262
if (!response.ok) {
6363
throw new Error('Network response was not ok');

.github/workflows/preview.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ jobs:
6161
// Find the subroute root from the current URL. Just the pattern components/pr-preview/pr-<PR_NUMBER>
6262
const parts = window.location.pathname.split('/');
6363
let realUrl;
64-
if (parts[1] === 'pr-preview')) {
65-
realUrl = '/' + parts.slice(0, 4).join('/') + '/';
64+
if (parts[2] === 'pr-preview') {
65+
realUrl = '/' + parts.slice(1, 4).join('/') + '/';
6666
} else {
6767
// If not a PR preview, redirect to the main page
68-
realUrl = parts.slice(0, 4);
68+
realUrl = '/' + parts.slice(1, 4).join('/');
6969
}
7070
// Manually fetch the index.html file from the correct subroute
71-
fetch(realUrl + 'index.html')
71+
fetch(realUrl)
7272
.then(response => {
7373
if (!response.ok) {
7474
throw new Error('Network response was not ok');

0 commit comments

Comments
 (0)