From d2eada779e4c477736f75d773e6807405a205068 Mon Sep 17 00:00:00 2001 From: OnkarRuikar <87750369+OnkarRuikar@users.noreply.github.com> Date: Thu, 23 Jan 2025 16:24:14 +0530 Subject: [PATCH] put the script in a separate file --- .github/workflows/404.html | 9 +-------- .github/workflows/404.js | 8 ++++++++ .github/workflows/pr-test.yml | 1 + 3 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/404.js diff --git a/.github/workflows/404.html b/.github/workflows/404.html index 116ddbb7f8ad827d..4c3a717c8aa2b0d9 100644 --- a/.github/workflows/404.html +++ b/.github/workflows/404.html @@ -2,16 +2,9 @@ 404 Page Not Found +

404 Page Not Found

- diff --git a/.github/workflows/404.js b/.github/workflows/404.js new file mode 100644 index 0000000000000000..b973f7202270e41b --- /dev/null +++ b/.github/workflows/404.js @@ -0,0 +1,8 @@ +window.addEventListener("DOMContentLoaded", () => { + if (document.location.hostname.endsWith("content.dev.mdn.mozit.cloud")) { + const link = document.createElement("a"); + link.href = `https://developer.mozilla.org${location.pathname}`; + link.textContent = "View on MDN production server"; + document.body.appendChild(link); + } +}); diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index cf61e3a63ebcada0..e592b120cac026f9 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -108,6 +108,7 @@ jobs: # Add the custom 404 page to provide production links to the unbuilt documents mkdir -p ${BUILD_OUT_ROOT}/en-us/_spas/ cp -v ./.github/workflows/404.html ${BUILD_OUT_ROOT}/en-us/_spas/404.html + cp -v ./.github/workflows/404.js ${BUILD_OUT_ROOT}/en-us/_spas/404.js # Download the raw diff blob and store that inside the build # directory.