From d476c1a8dc6cf206a830521c74a046771c8804ec Mon Sep 17 00:00:00 2001 From: Richard Dern Date: Sun, 29 Mar 2026 18:13:02 +0200 Subject: [PATCH] Adapte le rapport des liens morts au nouveau format --- layouts/partials/external-links-report.html | 30 ++++++++++++++----- .../_partials/external-links-report.html | 30 ++++++++++++++----- .../layouts/_partials/liens-morts/report.html | 10 ++++--- .../layouts/_partials/liens-morts/report.html | 14 +++++---- 4 files changed, 60 insertions(+), 24 deletions(-) diff --git a/layouts/partials/external-links-report.html b/layouts/partials/external-links-report.html index 87c34a03..5c2c3ba3 100644 --- a/layouts/partials/external-links-report.html +++ b/layouts/partials/external-links-report.html @@ -32,18 +32,34 @@ {{- $links := slice -}} {{- range $sourceLinks -}} - {{- $status := "" -}} - {{- with index . "status" -}} - {{- $status = printf "%v" . -}} - {{- end -}} - {{- if eq $status "" -}} - {{- with index . "code" -}} - {{- $status = printf "%v" . -}} + {{- $code := "" -}} + {{- if isset . "code" -}} + {{- $rawCode := index . "code" -}} + {{- if ne $rawCode nil -}} + {{- $code = printf "%v" $rawCode -}} {{- end -}} {{- end -}} + {{- $statusText := "" -}} + {{- with index . "statusText" -}} + {{- $statusText = printf "%v" . -}} + {{- end -}} + {{- if eq $statusText "" -}} + {{- with index . "status" -}} + {{- $statusText = printf "%v" . -}} + {{- end -}} + {{- end -}} + {{- $status := "" -}} + {{- with $code -}} + {{- $status = . -}} + {{- end -}} + {{- if and (eq $status "") (ne $statusText "") -}} + {{- $status = $statusText -}} + {{- end -}} {{- $links = $links | append (dict "url" (default "" (index . "url")) + "code" $code + "statusText" $statusText "status" $status "locations" (default (slice) (index . "locations")) "errorType" (default "" (index . "errorType")) diff --git a/themes/2026/layouts/_partials/external-links-report.html b/themes/2026/layouts/_partials/external-links-report.html index 87c34a03..5c2c3ba3 100644 --- a/themes/2026/layouts/_partials/external-links-report.html +++ b/themes/2026/layouts/_partials/external-links-report.html @@ -32,18 +32,34 @@ {{- $links := slice -}} {{- range $sourceLinks -}} - {{- $status := "" -}} - {{- with index . "status" -}} - {{- $status = printf "%v" . -}} - {{- end -}} - {{- if eq $status "" -}} - {{- with index . "code" -}} - {{- $status = printf "%v" . -}} + {{- $code := "" -}} + {{- if isset . "code" -}} + {{- $rawCode := index . "code" -}} + {{- if ne $rawCode nil -}} + {{- $code = printf "%v" $rawCode -}} {{- end -}} {{- end -}} + {{- $statusText := "" -}} + {{- with index . "statusText" -}} + {{- $statusText = printf "%v" . -}} + {{- end -}} + {{- if eq $statusText "" -}} + {{- with index . "status" -}} + {{- $statusText = printf "%v" . -}} + {{- end -}} + {{- end -}} + {{- $status := "" -}} + {{- with $code -}} + {{- $status = . -}} + {{- end -}} + {{- if and (eq $status "") (ne $statusText "") -}} + {{- $status = $statusText -}} + {{- end -}} {{- $links = $links | append (dict "url" (default "" (index . "url")) + "code" $code + "statusText" $statusText "status" $status "locations" (default (slice) (index . "locations")) "errorType" (default "" (index . "errorType")) diff --git a/themes/2026/layouts/_partials/liens-morts/report.html b/themes/2026/layouts/_partials/liens-morts/report.html index 642f08d1..2baa1084 100644 --- a/themes/2026/layouts/_partials/liens-morts/report.html +++ b/themes/2026/layouts/_partials/liens-morts/report.html @@ -16,15 +16,15 @@ - - + + + {{- range $links -}} - - + + + {{- end -}} diff --git a/themes/42/layouts/_partials/liens-morts/report.html b/themes/42/layouts/_partials/liens-morts/report.html index d1e23626..227f5952 100644 --- a/themes/42/layouts/_partials/liens-morts/report.html +++ b/themes/42/layouts/_partials/liens-morts/report.html @@ -17,17 +17,15 @@
URL EmplacementsStatutURLCodeDétails
{{ .url }} {{- $locations := default (slice) .locations -}} {{- if gt (len $locations) 0 -}} @@ -74,7 +74,9 @@ Emplacements inconnus {{- end -}} {{ .status }}{{ .url }}{{ with .code }}{{ . }}{{ end }}{{ with .statusText }}{{ . }}{{ end }}
- - + + + {{- range $links }} - - + + + {{- end }}
URL EmplacementsStatutURLCodeDétails
- {{ .url }} - {{- $locations := default (slice) .locations -}} {{- if gt (len $locations) 0 -}} @@ -62,7 +60,11 @@ Emplacements inconnus {{- end -}} {{ .status }} + {{ .url }} + {{ with .code }}{{ . }}{{ end }}{{ with .statusText }}{{ . }}{{ end }}