1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-12-05 01:12:11 +00:00
seirdy.one/layouts/_default/_markup/render-link.html
Rohan Kumar 3c00cfd4e8
Internal: markdown extension for adding link attrs
More concise than using <a> every time i need to add an attr to a link
2022-02-28 13:41:24 -08:00

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. */ -}}