|
|
|
@@ -14,72 +14,68 @@
|
|
|
|
{{- $deadInfo := dict -}}
|
|
|
|
{{- $deadInfo := dict -}}
|
|
|
|
{{- $isDeadLink := false -}}
|
|
|
|
{{- $isDeadLink := false -}}
|
|
|
|
{{- with (first 1 (where $deadList "url" .Destination)) -}}
|
|
|
|
{{- with (first 1 (where $deadList "url" .Destination)) -}}
|
|
|
|
{{- $deadInfo = index . 0 -}}
|
|
|
|
{{- $deadInfo = index . 0 -}}
|
|
|
|
{{- $isDeadLink = true -}}
|
|
|
|
{{- $isDeadLink = true -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- $newURL := .Destination -}}
|
|
|
|
{{- $newURL := .Destination -}}
|
|
|
|
{{- if and $isExternal $aff -}}
|
|
|
|
{{- if and $isExternal $aff -}}
|
|
|
|
{{- $param := $aff.param -}}
|
|
|
|
{{- $param := $aff.param -}}
|
|
|
|
{{- $value := $aff.value -}}
|
|
|
|
{{- $value := $aff.value -}}
|
|
|
|
{{- $isAffiliated = true -}}
|
|
|
|
{{- $isAffiliated = true -}}
|
|
|
|
{{- if $query -}}
|
|
|
|
{{- if $query -}}
|
|
|
|
{{- $newURL = printf "%s://%s%s?%s&%s=%s" $parsed.Scheme $host $path $query $param $value -}}
|
|
|
|
{{- $newURL = printf "%s://%s%s?%s&%s=%s" $parsed.Scheme $host $path $query $param $value -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- $newURL = printf "%s://%s%s?%s=%s" $parsed.Scheme $host $path $param $value -}}
|
|
|
|
{{- $newURL = printf "%s://%s%s?%s=%s" $parsed.Scheme $host $path $param $value -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- $titlePrefix := cond $isAffiliated "Lien affilié" (cond $isExternal "Lien externe" "") -}}
|
|
|
|
{{- $titlePrefix := cond $isAffiliated "Lien affilié" (cond $isExternal "Lien externe" "") -}}
|
|
|
|
{{- $classes := slice -}}
|
|
|
|
{{- $classes := slice -}}
|
|
|
|
{{- if $isExternal -}}
|
|
|
|
{{- if $isExternal -}}
|
|
|
|
{{- $classes = $classes | append "external" -}}
|
|
|
|
{{- $classes = $classes | append "external" -}}
|
|
|
|
{{- if $isAffiliated -}}
|
|
|
|
{{- if $isAffiliated -}}
|
|
|
|
{{- $classes = $classes | append "affiliated" -}}
|
|
|
|
{{- $classes = $classes | append "affiliated" -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- if $isDeadLink -}}
|
|
|
|
{{- if $isDeadLink -}}
|
|
|
|
{{- $statusRaw := index $deadInfo "status" -}}
|
|
|
|
{{- $statusRaw := index $deadInfo "status" -}}
|
|
|
|
{{- $statusCode := "" -}}
|
|
|
|
{{- $statusCode := "" -}}
|
|
|
|
{{- with $statusRaw -}}
|
|
|
|
{{- with $statusRaw -}}
|
|
|
|
{{- $statusCode = printf "%v" . -}}
|
|
|
|
{{- $statusCode = printf "%v" . -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- if eq $statusCode "404" -}}
|
|
|
|
{{- if eq $statusCode "404" -}}
|
|
|
|
{{- $classes = $classes | append "dead" -}}
|
|
|
|
{{- $classes = $classes | append "dead" -}}
|
|
|
|
{{- else if gt (len $statusCode) 0 -}}
|
|
|
|
{{- else if gt (len $statusCode) 0 -}}
|
|
|
|
{{- $classes = $classes | append "problematic" -}}
|
|
|
|
{{- $classes = $classes | append "problematic" -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- $classes = $classes | append "dead" -}}
|
|
|
|
{{- $classes = $classes | append "dead" -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- $titleParts := slice -}}
|
|
|
|
{{- $titleParts := slice -}}
|
|
|
|
{{- with $titlePrefix -}}
|
|
|
|
{{- with $titlePrefix -}}
|
|
|
|
{{- $titleParts = $titleParts | append . -}}
|
|
|
|
{{- $titleParts = $titleParts | append . -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- with .Title -}}
|
|
|
|
{{- with .Title -}}
|
|
|
|
{{- $titleParts = $titleParts | append . -}}
|
|
|
|
{{- $titleParts = $titleParts | append . -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- if $isDeadLink -}}
|
|
|
|
{{- if $isDeadLink -}}
|
|
|
|
{{- $deadDetails := slice -}}
|
|
|
|
{{- $deadDetails := slice -}}
|
|
|
|
{{- with (index $cacheEntry "checkedAt") -}}
|
|
|
|
{{- with (index $cacheEntry "checkedAt") -}}
|
|
|
|
{{- $deadDetails = $deadDetails | append (printf "inaccessible depuis le %s" (time.Format "02/01/2006" (time .))) -}}
|
|
|
|
{{- $deadDetails = $deadDetails | append (printf "inaccessible depuis le %s" (time.Format "02/01/2006" (time .))) -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- with (index $cacheEntry "errorType") -}}
|
|
|
|
{{- with (index $cacheEntry "errorType") -}}
|
|
|
|
{{- $deadDetails = $deadDetails | append (printf "raison %s" .) -}}
|
|
|
|
{{- $deadDetails = $deadDetails | append (printf "raison %s" .) -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- with (index $deadInfo "status") -}}
|
|
|
|
{{- with (index $deadInfo "status") -}}
|
|
|
|
{{- $deadDetails = $deadDetails | append (printf "statut %v" .) -}}
|
|
|
|
{{- $deadDetails = $deadDetails | append (printf "statut %v" .) -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- with $deadDetails -}}
|
|
|
|
{{- with $deadDetails -}}
|
|
|
|
{{- $titleParts = $titleParts | append (printf "(%s)" (delimit . " ; ")) -}}
|
|
|
|
{{- $titleParts = $titleParts | append (printf "(%s)" (delimit . " ; ")) -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- $titleValue := delimit $titleParts " - " -}}
|
|
|
|
{{- $titleValue := delimit $titleParts " - " -}}
|
|
|
|
{{- $relAttr := "" -}}
|
|
|
|
{{- $relAttr := "" -}}
|
|
|
|
{{- if $isExternal -}}
|
|
|
|
{{- if $isExternal -}}
|
|
|
|
{{- $relAttr = "noreferrer noopener" -}}
|
|
|
|
{{- $relAttr = "noreferrer noopener" -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}<a href="{{ $newURL }}" title="{{ $titleValue }}" {{- if gt (len $relAttr) 0 -}} rel="{{ $relAttr }}" {{- end
|
|
|
|
<a href="{{ $newURL }}" title="{{ $titleValue }}"
|
|
|
|
-}} {{- if gt (len $classes) 0 -}} class="{{ delimit $classes ` ` }}" {{- end -}}>{{- .Text | safeHTML -}}</a>{{- /*
|
|
|
|
{{- if gt (len $relAttr) 0 -}} rel="{{ $relAttr }}"{{- end -}}
|
|
|
|
*/ -}}
|
|
|
|
{{- if gt (len $classes) 0 -}} class="{{ delimit $classes ` ` }}"{{- end -}}>
|
|
|
|
|
|
|
|
{{- .Text | safeHTML -}}
|
|
|
|
|
|
|
|
</a>
|
|
|
|
|
|
|
|
{{- /* */ -}}
|
|
|
|
|