17 lines
		
	
	
		
			873 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			17 lines
		
	
	
		
			873 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
{{/*
 | 
						|
  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" }}
 | 
						|
{{ $isWebLink := or $isExternalLink (eq 0 (.Destination | strings.Count ":")) }}
 | 
						|
{{ $isTelLink := strings.HasPrefix .Destination "tel:" }}
 | 
						|
{{ $isMailtoLink := strings.HasPrefix .Destination "mailto:" }}
 | 
						|
{{- if $isWebLink -}}
 | 
						|
  {{ $hasSlash := in .Destination "/" }}
 | 
						|
  {{ $link := cond (and $isWebLink (and (not $hasSlash) (not $isExternalLink))) (path.Join "/" .Page.File.Dir .Destination) .Destination }}
 | 
						|
  <a href="{{ $link | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if $isExternalLink }} rel="noopener"{{ end }}>{{ .Text | safeHTML }}</a>
 | 
						|
{{- else if $isMailtoLink -}}
 | 
						|
  {{ partial "contact/mail" .Destination }}
 | 
						|
{{- else if $isTelLink -}}
 | 
						|
  {{ partial "contact/telephone" .Destination }}
 | 
						|
{{- end -}}
 |