add MaskedEmail param and gmail icon

This commit is contained in:
Reorx 2022-04-21 18:01:25 +08:00
parent 2628a07c95
commit 7522de02b5
5 changed files with 25 additions and 3 deletions

View File

@ -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

View File

@ -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">

View File

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

View File

@ -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">

View File

@ -1,8 +1,16 @@
<div class="social-icons">
{{- range .icons }}
<a href="{{ trim .url " " }}" target="_blank" rel="noopener noreferrer me" title="{{ .name | title }}">
{{- $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 }}">
{{ safeHTML (index $.svg $icon_name | default $.svg.default) }}
</a>
{{- end }}
{{- end }}
</div>