hugo-geekblog/layouts/_default/_markup/render-link.html

8 lines
431 B
HTML
Raw Normal View History

{{- $raw := or (hasPrefix .Text "<img") (hasPrefix .Text "<figure") -}}
{{- $isRemote:= or (in .Destination ":") ( hasPrefix .Destination "//") -}}
{{- $destination := .Destination | safeURL -}}
{{- if not $isRemote -}}
{{- $destination = $destination | relURL -}}
{{- end -}}
<a class="gblog-post__link{{ if $raw }}--raw{{ end }}" href="{{ $destination }}"{{ with .Title }} title="{{ . }}"{{ end }}>{{ .Text | safeHTML }}</a>