summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReorx <novoreorx@gmail.com>2022-04-21 18:01:25 +0800
committerReorx <novoreorx@gmail.com>2022-04-21 18:01:25 +0800
commit7522de02b51c501be31651a447ea1b195beef0cc (patch)
treecd5d93eb0a81120008cb765b51fc82349d57320a
parent2628a07c95a7205a09b2f7bdefe9629c7400e423 (diff)
add MaskedEmail param and gmail icon
-rw-r--r--data/svg.toml3
-rw-r--r--layouts/partials/footer.html11
-rw-r--r--layouts/partials/home_info.html2
-rw-r--r--layouts/partials/index_profile.html2
-rw-r--r--layouts/partials/social_icons.html10
5 files changed, 25 insertions, 3 deletions
diff --git a/data/svg.toml b/data/svg.toml
index 1464a83..4eb4c51 100644
--- a/data/svg.toml
+++ b/data/svg.toml
@@ -243,6 +243,9 @@ gitlab = '''
</path>
</svg>
'''
+gmail = '''
+<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Gmail</title><path d="M24 5.457v13.909c0 .904-.732 1.636-1.636 1.636h-3.819V11.73L12 16.64l-6.545-4.91v9.273H1.636A1.636 1.636 0 0 1 0 19.366V5.457c0-2.023 2.309-3.178 3.927-1.964L5.455 4.64 12 9.548l6.545-4.91 1.528-1.145C21.69 2.28 24 3.434 24 5.457z"/></svg>
+'''
goodreads = '''
<svg xmlns="http://www.w3.org/2000/svg" role="img" fill="currentColor" viewBox="0 0 24 24">
<path
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index 94cc321..28d3086 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -217,6 +217,17 @@
})();
</script>
+
+{{- /* Base64Email */}}
+{{- if (.Param "MaskedEmail") }}
+<script>
+ document.querySelectorAll('.masked-email').forEach((el) => {
+ el.innerText = atob(el.innerText);
+ })
+</script>
+{{- end -}}
+
+
{{- /* Search */}}
{{- if (eq .Layout `search`) -}}
<link crossorigin="anonymous" rel="preload" as="fetch" href="../index.json">
diff --git a/layouts/partials/home_info.html b/layouts/partials/home_info.html
index 21b9046..3127da4 100644
--- a/layouts/partials/home_info.html
+++ b/layouts/partials/home_info.html
@@ -7,7 +7,7 @@
{{- trim .Content "\n" | markdownify -}}
</section>
<footer class="entry-footer">
- {{ partial "social_icons.html" (dict "icons" site.Params.socialIcons "svg" $.Site.Data.svg) }}
+ {{- partial "social_icons.html" (dict "icons" site.Params.socialIcons "svg" $.Site.Data.svg "MaskedEmail" site.Params.MaskedEmail) -}}
</footer>
</article>
{{- end -}}
diff --git a/layouts/partials/index_profile.html b/layouts/partials/index_profile.html
index 24e34fd..d48acd7 100644
--- a/layouts/partials/index_profile.html
+++ b/layouts/partials/index_profile.html
@@ -29,7 +29,7 @@
{{- end }}
<h1>{{ .title | default site.Title | markdownify }}</h1>
<span>{{ .subtitle | markdownify }}</span>
- {{- partial "social_icons.html" (dict "icons" site.Params.socialIcons "svg" $.Site.Data.svg) -}}
+ {{- partial "social_icons.html" (dict "icons" site.Params.socialIcons "svg" $.Site.Data.svg "MaskedEmail" site.Params.MaskedEmail) -}}
{{- with .buttons }}
<div class="buttons">
diff --git a/layouts/partials/social_icons.html b/layouts/partials/social_icons.html
index 62e156c..7a6cfbe 100644
--- a/layouts/partials/social_icons.html
+++ b/layouts/partials/social_icons.html
@@ -1,8 +1,16 @@
<div class="social-icons">
{{- range .icons }}
+ {{- $icon_name := ( trim .name " " | lower )}}
+
+ {{- if (eq .url "email") }}
+ <a href="mailto:{{ $.MaskedEmail }}" title="{{ .name | title }}">
+ {{ safeHTML (index $.svg $icon_name | default $.svg.default) }}
+ </a>
+ {{- else }}
<a href="{{ trim .url " " }}" target="_blank" rel="noopener noreferrer me" title="{{ .name | title }}">
- {{- $icon_name := ( trim .name " " | lower )}}
{{ safeHTML (index $.svg $icon_name | default $.svg.default) }}
</a>
{{- end }}
+
+ {{- end }}
</div>