From 50b42a5a331dc3aaa05091a822f851c78adcbc5d Mon Sep 17 00:00:00 2001 From: Helen Chong <119173961+helenclx@users.noreply.github.com> Date: Fri, 27 Dec 2024 15:21:08 +0800 Subject: [PATCH] Add encoded email address to contact page --- src/.htaccess.njk | 3 +++ src/_data/sitemeta.js | 2 ++ src/assets/css/utility.css | 1 + src/slashes/headerlinks/contact.njk | 1 + 4 files changed, 7 insertions(+) diff --git a/src/.htaccess.njk b/src/.htaccess.njk index 9cf4a7cd..b14fc051 100644 --- a/src/.htaccess.njk +++ b/src/.htaccess.njk @@ -28,6 +28,9 @@ RewriteRule ^ /%1 [NE,L,R] RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*)/?$ /$1.php [L] +# Redirect obfuscated email links to mailto link +RewriteRule ^.*{{ sitemeta.siteAuthor.emailDecoyUrl }}.*$ "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 d8a4bf51..0d45996a 100644 --- a/src/_data/sitemeta.js +++ b/src/_data/sitemeta.js @@ -4,6 +4,8 @@ export const siteUrl = "https://" + siteDomain || "http://localhost:8080"; export const siteAuthor = { name: "Helen Chong", email: "contact@helenchong.dev", + emailEncoded: 'contact@helenchong.nospam.dev', + emailDecoyUrl: "emailme/", url: siteUrl + "/about", fediverse: { handle: "@helenchong@social.lol", diff --git a/src/assets/css/utility.css b/src/assets/css/utility.css index b37a8a1e..ef73f28e 100644 --- a/src/assets/css/utility.css +++ b/src/assets/css/utility.css @@ -9,6 +9,7 @@ .text-center { text-align: center; } .text-bold { font-weight: 700; } .el-top-margin { margin-top: 1.5em; } +.email-encoded b { display: none; } .inline-icon { display: inline-block; diff --git a/src/slashes/headerlinks/contact.njk b/src/slashes/headerlinks/contact.njk index 19f922cd..6716ef3b 100644 --- a/src/slashes/headerlinks/contact.njk +++ b/src/slashes/headerlinks/contact.njk @@ -10,6 +10,7 @@ eleventyNavigation:
Alternately, you can contact me through other methods:
{{ sitemeta.siteAuthor.matrix }}
{{ sitemeta.siteAuthor.signal }}