19 lines
704 B
HTML
19 lines
704 B
HTML
{{/* https://discourse.gohugo.io/t/how-can-i-add-rel-nofollow-or-target-blank-or-rel-external-or-other-similar-attributes-to-specific-links-in-my-posts-in-markdown/32131/7 */}}
|
|
{{- $parsedTitle := dict -}}
|
|
{{- with .Title -}}
|
|
{{- $parsedTitle = partial "functions/parse-title-attribute.html" . -}}
|
|
{{- end -}}
|
|
|
|
<a href="{{ .Destination | safeURL }}"
|
|
{{- with $parsedTitle.title }} title="{{ . }}"{{- end -}}
|
|
{{- with $parsedTitle.attributes -}}
|
|
{{- range $k, $v := . -}}
|
|
{{- printf " %s=%q" $k $v | safeHTMLAttr -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{ if gt (strings.Count "http" (.Destination | safeURL)) 0}}
|
|
target="_blank"
|
|
{{ end }}
|
|
>{{ .Text | safeHTML }}</a>
|
|
|
|
{{- /* Strip trailing space. */ -}} |