Add domain redirect script

This commit is contained in:
Helen Chong 2024-05-31 08:23:16 +08:00
parent ec6a1e7f4c
commit 35707c0f2e
2 changed files with 9 additions and 0 deletions

View File

@ -33,6 +33,7 @@
{% endblock %}
{# JavaScript #}
<script src="/assets/js/redirect.js"></script>
<script src="/assets/js/details-utils.js" defer></script>
<title>

View File

@ -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);
}