{{- $page := .page }} {{- if and (not $page) .context }} {{- $page = .context }} {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'link' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration/#5180" $page.File.Path }} {{- end }} {{- $url := .url }} {{- $title := .title | default "" }} {{- $title = trim $title " " }} {{- $content := .content }} {{- $target := .target | default "" }} {{- if and (eq (len $target) 0) (or (strings.HasPrefix $url "http://") (strings.HasPrefix $url "https://") ) }} {{- $target = "_blank" }} {{- if isset $page.Site.Params "externallinktarget" }} {{- $target = $page.Site.Params.externalLinkTarget }} {{- end }} {{- end -}} {{ $content | safeHTML }}