{{- $report := partial "external-links-report.html" . -}} {{- $allPages := where site.Pages ".File" "!=" nil -}} {{- $links := default (slice) $report.links -}} {{- $generatedLabel := "" -}} {{- with $report.generatedAt -}} {{- $generatedLabel = (time .).Format "02/01/2006" -}} {{- end -}}
| Emplacements | URL | Code | Détails |
|---|---|---|---|
{{- $locations := default (slice) .locations -}}
{{- 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 -}}
{{- if $matchedPage -}}
{{ $matchedPage.Title }}
{{- else if $file -}}
{{ $file }}{{ if $line }}:{{ $line }}{{ end }}
{{- else if $pagePath -}}
{{ $pagePath }}
{{- else -}}
Emplacement inconnu
{{- end -}}
{{- end -}} {{- else -}} Emplacements inconnus {{- end -}} |
{{ .url }} | {{ with .code }}{{ . }}{{ end }} |
{{ with .statusText }}{{ . }}{{ end }} |