From 35707c0f2eee4672202d5b7a46ced3f0cd4f14e5 Mon Sep 17 00:00:00 2001 From: Helen Chong <119173961+helenclx@users.noreply.github.com> Date: Fri, 31 May 2024 08:23:16 +0800 Subject: [PATCH] Add domain redirect script --- src/_includes/global/baselayout.njk | 1 + src/assets/js/redirect.js | 8 ++++++++ 2 files changed, 9 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..c83285f8 --- /dev/null +++ b/src/assets/js/redirect.js @@ -0,0 +1,8 @@ +const currentUrl = window.location.href; +const oldDomain = 'leilukin.neocities.org'; +const newDomain = 'leilukin.com'; + +if (currentUrl.includes(oldDomain)) { + const newUrl = currentUrl.replace(oldDomain, newDomain); + location.replace(newUrl); +} \ No newline at end of file