mirror of
https://git.sr.ht/~seirdy/seirdy.one
synced 2024-11-10 08:12:11 +00:00
3c00cfd4e8
More concise than using <a> every time i need to add an attr to a link
15 lines
452 B
HTML
15 lines
452 B
HTML
{{- $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 -}}
|
|
>{{ .Text | safeHTML }}</a>
|
|
|
|
{{- /* Strip trailing space. */ -}}
|