summaryrefslogtreecommitdiff
path: root/layouts
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 /layouts
parent2628a07c95a7205a09b2f7bdefe9629c7400e423 (diff)
add MaskedEmail param and gmail icon
Diffstat (limited to 'layouts')
-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
4 files changed, 22 insertions, 3 deletions
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>