From 15e9a04106c68f54de93ea15095db02d43f6a2e3 Mon Sep 17 00:00:00 2001 From: Helen Chong <119173961+helenclx@users.noreply.github.com> Date: Sat, 1 Jun 2024 08:07:28 +0800 Subject: [PATCH] Restores redirect script temporarily --- src/_includes/global/baselayout.njk | 1 + src/assets/js/redirect.js | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 src/assets/js/redirect.js diff --git a/src/_includes/global/baselayout.njk b/src/_includes/global/baselayout.njk index 3b5fbc5d..df2af76c 100644 --- a/src/_includes/global/baselayout.njk +++ b/src/_includes/global/baselayout.njk @@ -33,6 +33,7 @@ {% endblock %} {# JavaScript #} + diff --git a/src/assets/js/redirect.js b/src/assets/js/redirect.js new file mode 100644 index 00000000..4862036c --- /dev/null +++ b/src/assets/js/redirect.js @@ -0,0 +1,12 @@ +const currentUrl = window.location.href; +const oldDomain = 'leilukin.neocities.org'; +const newDomain = 'leilukin.com'; + +const redirectUrl = (oldStr, newStr) => { + if (currentUrl.includes(oldStr)) { + const newUrl = currentUrl.replace(oldStr, newStr); + location.replace(newUrl); + } +} + +redirectUrl(oldDomain, newDomain); \ No newline at end of file