{{- $report := partialCached "external-links-report.html" (dict "WithLocations" true) "with-locations" -}} {{- $allPages := where site.Pages ".File" "!=" nil -}} {{- $replacements := default (dict) site.Data.replacements -}} {{- $sourceLinks := default (slice) $report.links -}} {{- $links := slice -}} {{- range $sourceLinks -}} {{- $manualMarked := false -}} {{- with index . "manualMarked" -}} {{- $manualMarked = . -}} {{- end -}} {{- if or $manualMarked (eq (index $replacements .url) nil) -}} {{- $links = $links | append . -}} {{- end -}} {{- end -}} {{- $links = sort $links "url" -}} {{- $generatedLabel := "" -}} {{- with $report.generatedAt -}} {{- $generatedLabel = (time .).Format "02/01/2006" -}} {{- end -}}
Dernière mise à jour
{{ $generatedLabel }}
Liens morts détectés
{{ len $links }}
{{- range $links -}} {{- end -}}
Emplacements URL Code Détails
{{- $manualMarked := false -}} {{- with index . "manualMarked" -}} {{- $manualMarked = . -}} {{- end -}} {{- $locations := default (slice) .locations -}} {{- $seenLocations := dict -}} {{- $hasRenderedLocation := false -}} {{- if gt (len $locations) 0 -}} {{- range $locations -}} {{- $file := "" -}} {{- $line := "" -}} {{- $pagePath := "" -}} {{- if reflect.IsMap . -}} {{- with index . "file" -}} {{- $file = printf "%v" . -}} {{- end -}} {{- with index . "line" -}} {{- $line = printf "%v" . -}} {{- end -}} {{- with index . "page" -}} {{- $pagePath = printf "%v" . -}} {{- end -}} {{- else -}} {{- $pagePath = printf "%v" . -}} {{- end -}} {{- $matchedPage := false -}} {{- if $pagePath -}} {{- $candidate := site.GetPage $pagePath -}} {{- if $candidate -}} {{- $matchedPage = $candidate -}} {{- end -}} {{- end -}} {{- if and (not $matchedPage) $file -}} {{- $normalized := replaceRE "^content/" "" $file -}} {{- $candidates := where $allPages "File.Path" $normalized -}} {{- if gt (len $candidates) 0 -}} {{- $matchedPage = index $candidates 0 -}} {{- end -}} {{- end -}} {{- $locationKey := "unknown" -}} {{- if $matchedPage -}} {{- $locationKey = printf "page:%s" $matchedPage.Path -}} {{- else if $file -}} {{- $locationKey = printf "file:%s" $file -}} {{- else if $pagePath -}} {{- $locationKey = printf "path:%s" $pagePath -}} {{- end -}} {{- if not (isset $seenLocations $locationKey) -}} {{- $seenLocations = merge $seenLocations (dict $locationKey true) -}} {{- $hasRenderedLocation = true -}} {{- if $matchedPage -}} {{ $matchedPage.Title }} {{- else if $file -}} {{ $file }}{{ if $line }}:{{ $line }}{{ end }} {{- else if $pagePath -}} {{ $pagePath }} {{- else -}} Emplacement inconnu {{- end -}}
{{- end -}} {{- end -}} {{- end -}} {{- if not $hasRenderedLocation -}} Emplacements inconnus {{- end -}}
{{- if $manualMarked -}} {{ .url }} {{- else -}} {{ .url }} {{- end -}} {{ with .code }}{{ . }}{{ end }} {{ with .statusText }}{{ . }}{{ end }}