Skip to content

Commit 3a609cd

Browse files
fix mailto links (#22715)
<!--Delete sections as needed --> ## Description Fix mailto links to work with the following syntax: `[email me](mailto:[email protected])` Can verify at https://deploy-preview-22715--docsdocker.netlify.app/desktop/enterprise/ ## Related issues or tickets https://docker.slack.com/archives/C039ZM6GH4Z/p1748022452990369 ## Reviews <!-- Notes for reviewers here --> <!-- List applicable reviews (optionally @tag reviewers) --> - [ ] Editorial review Signed-off-by: Craig <[email protected]>
1 parent 61d245a commit 3a609cd

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)