Skip to content

Commit

Permalink
Mark external links
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Wasserka committed Sep 23, 2024
1 parent c87db7b commit 230fad5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion layouts/_default/_markup/render-link.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if (not (or (strings.HasPrefix .Destination "http") (strings.HasPrefix .Destination "#"))) }}
{{ $isExternal := (strings.HasPrefix .Destination "http") }}
{{- if (not (or $isExternal (strings.HasPrefix .Destination "#"))) }}
{{ $style := "" }}
{{ with $.PageInner.GetPage (index (strings.Split .Destination "#") 0) }}
{{ else }}
Expand All @@ -16,6 +17,7 @@
{{- with .Title }} title="{{ . }}"{{ end -}}
{{- if (strings.HasPrefix .Destination "http") }} target="_blank" rel="external"{{ end -}}
>
{{ if $isExternal }}🔗 {{ end }}
{{- with .Text }}{{ . }}{{ end -}}
</a>
{{ end -}}

0 comments on commit 230fad5

Please sign in to comment.