From 57a04b10dcc5aa754eaa17554df93f084ae2bc26 Mon Sep 17 00:00:00 2001 From: Helen Chong <119173961+helenclx@users.noreply.github.com> Date: Tue, 10 Dec 2024 18:20:57 +0800 Subject: [PATCH] Use HTTP redirect to obfuscate email address --- src/.htaccess.njk | 3 +++ src/_data/sitemeta.js | 2 +- src/_includes/global/footer.njk | 2 +- src/assets/css/utility.css | 1 + src/index.njk | 2 +- src/slashes/navbarlinks/about.md | 2 +- 6 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/.htaccess.njk b/src/.htaccess.njk index febf04ab..46c01f18 100644 --- a/src/.htaccess.njk +++ b/src/.htaccess.njk @@ -14,6 +14,9 @@ Header set Cache-Control "no-cache, public" RewriteEngine on +# Redirect obfuscated email links to mailto link +RewriteRule ^email/$ "mailto:{{ sitemeta.siteAuthor.email }}" [R=301,L] + # Block bad bots RewriteCond %{HTTP_USER_AGENT} ({{ robots.htaccess }}) [NC] RewriteRule .* https://nocommercialuse.org/ [L] \ No newline at end of file diff --git a/src/_data/sitemeta.js b/src/_data/sitemeta.js index 4688fb79..70a5d1f4 100644 --- a/src/_data/sitemeta.js +++ b/src/_data/sitemeta.js @@ -4,7 +4,7 @@ export const siteUrl = "https://" + siteDomain || "http://localhost:8080"; export const siteAuthor = { name: "Leilukin", email: "contact@leilukin.com", - emailEncoded: "contact@leilukin.com", + emailEncoded: 'contact@leilukin.example.com', url: siteUrl + "/about" }; export const siteLanguage = "en"; diff --git a/src/_includes/global/footer.njk b/src/_includes/global/footer.njk index cc359977..60ebfa11 100644 --- a/src/_includes/global/footer.njk +++ b/src/_includes/global/footer.njk @@ -1,7 +1,7 @@