diff --git a/themes/tfsci/layouts/_default/_markup/render-link.html b/themes/tfsci/layouts/_default/_markup/render-link.html index a43bbf5..3edd21f 100644 --- a/themes/tfsci/layouts/_default/_markup/render-link.html +++ b/themes/tfsci/layouts/_default/_markup/render-link.html @@ -1,6 +1,6 @@ {{- $text := .Text -}} -{{- $destination := .Destination -}} -{{- $parsed := urls.Parse $destination -}} +{{- $href := .Destination -}} +{{- $parsed := urls.Parse $href -}} {{- if in (slice "http" "https") $parsed.Scheme -}} {{- if eq .Destination .Text -}} {{- $host := replaceRE `^www\.` "" $parsed.Host -}} @@ -15,9 +15,9 @@ {{- $articleName := replaceRE `^/articles/(\S+)/$` "$1" $parsed.Path -}} {{- with .Page.GetPage $articleName -}} {{- if not .Params.hidden -}} - {{- $destination = .Permalink -}} + {{- $href = .Permalink -}} {{- with $parsed.Fragment -}} - {{- $destination = print $destination "#" $parsed.EscapedFragment -}} + {{- $href = print $href "#" $parsed.EscapedFragment -}} {{- end -}} {{- end -}} {{- end -}} @@ -26,8 +26,10 @@ {{- end -}} {{- if eq $parsed.Scheme "mailto" -}} {{ cond (eq $text $parsed.Opaque) "" $text | safeHTML }} -{{- else if .Title -}} -{{ $text | safeHTML }} {{- else -}} -{{ $text | safeHTML }} +{{- $external := hasPrefix ($href | relURL) "http" -}} +{{ $text | safeHTML }} {{- end -}} \ No newline at end of file