Files
docker-docs/layouts/_default/_markup/render-link.html
Sarah Sanders d50fe6664f fix: open in new tab for links (#22820)
## Description
- Update Contribute `links.md` to verify that internal and external
links open in the same tab.
- Remove "open in new" tab icon 

## Related issues or tickets
https://docker.atlassian.net/browse/ENGDOCS-2717

## Reviews
- [ ] Technical review
- [ ] Editorial review
- [ ] Product review
2025-06-11 12:36:53 -04:00

14 lines
582 B
HTML

{{ $url := .Destination }}
{{- if (strings.HasPrefix $url "http") -}}
<a class="link" href="{{ $url | safeURL }}" rel="noopener">{{ .Text | safeHTML }}</a>
{{- else if (strings.HasPrefix $url "mailto:") -}}
<a class="link" href="{{ $url }}">{{ .Text | safeHTML }}</a>
{{- else if (strings.HasPrefix $url "/") -}}
{{ if (strings.HasSuffix (urls.Parse $url).Path ".md") }}
{{ $url = (ref page $url) }}
{{ end }}
<a class="link" href="{{ $url }}">{{ .Text | safeHTML }}</a>
{{- else -}}
<a class="link" href="{{ ref page $url }}">{{ .Text | safeHTML }}</a>
{{- end -}}