feat: Avancement dans l'architecture du site
This commit is contained in:
@ -1 +1,9 @@
|
||||
<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank" rel="noopener"{{ end }}>{{ .Text | safeHTML }}</a>
|
||||
{{/*
|
||||
S'il n'y a pas de / dans l'url d'un lien alors on ajoute le path du répertoire
|
||||
*/}}
|
||||
{{ $isExternalLink := strings.HasPrefix .Destination "http" }}
|
||||
{{ $isTelLink := strings.HasPrefix .Destination "tel:" }}
|
||||
{{ $isMailtoLink := strings.HasPrefix .Destination "mailto:" }}
|
||||
{{ $hasSlash := in .Destination "/" }}
|
||||
{{ $path := cond (or (or $isTelLink $isMailtoLink) $hasSlash) .Destination (path.Join "/" .Page.Dir .Destination) }}
|
||||
<a href="{{ $path | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if $isExternalLink }} target="_blank" rel="noopener"{{ end }}{{ if $isTelLink }} rel="nofollow"{{ end }}>{{ .Text | safeHTML }}</a>
|
||||
|
Reference in New Issue
Block a user