Skip to content

Commit 31b84f2

Browse files
fix mailto links
Signed-off-by: Craig <[email protected]>
1 parent d757ce6 commit 31b84f2

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

layouts/_default/_markup/render-link.html

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
{{ $url := .Destination }}
22
{{- if (strings.HasPrefix $url "http") -}}
33
{{/* external link, add icon */}}
4-
<a
5-
class="link"
6-
href="{{ $url | safeURL }}"
7-
rel="noopener">
8-
{{- .Text | safeHTML -}}
9-
<span class="pl-1 icon-svg icon-sm">
10-
{{- partialCached "icon" "open_in_new" "open_in_new" -}}
11-
</span></a>
4+
<a class="link" href="{{ $url | safeURL }}" rel="noopener">
5+
{{ .Text | safeHTML }}
6+
<span class="pl-1 icon-svg icon-sm">
7+
{{ partialCached "icon" "open_in_new" "open_in_new" }}
8+
</span>
9+
</a>
10+
{{- else if (strings.HasPrefix $url "mailto:") -}}
11+
{{/* mailto link, render as normal link */}}
12+
<a class="link" href="{{ $url }}">{{ .Text | safeHTML }}</a>
1213
{{- else if (strings.HasPrefix $url "/") -}}
1314
{{ if (strings.HasSuffix (urls.Parse $url).Path ".md") }}
1415
{{/* abs path to markdown file, use ref */}}

0 commit comments

Comments
 (0)