render-link.html 579 B

123456789101112
  1. {{- $sameSite := true -}}
  2. {{- $finalDest := .Destination -}}
  3. {{- if eq (.Destination | relURL) (.Destination | absURL) }}{{ $sameSite = false }}{{ end -}}
  4. {{- if not $sameSite -}}
  5. {{- if in $finalDest "?"}}{{ $finalDest = printf "%s%s" $finalDest "&utm_source=indieweb" -}}
  6. {{- else }}{{ $finalDest = printf "%s%s" $finalDest "?utm_source=indieweb" -}}
  7. {{- end -}}
  8. {{- end -}}
  9. <a href="{{ $finalDest }}"
  10. {{- if not $sameSite }} target="_blank"
  11. {{- with .Title }} rel="{{ . | safeHTML }}"{{ end }}
  12. {{- else }} rel="me"{{ end }}>{{.Text | safeHTML}}</a>