84 lines
2.7 KiB
HTML
84 lines
2.7 KiB
HTML
{{- $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 -}}
|
|
|
|
<dl>
|
|
<dt>Dernière mise à jour</dt>
|
|
<dd>{{ $generatedLabel }}</dd>
|
|
<dt>Liens morts détectés</dt>
|
|
<dd>{{ len $links }}</dd>
|
|
</dl>
|
|
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Emplacements</th>
|
|
<th>URL</th>
|
|
<th>Code</th>
|
|
<th>Détails</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{- range $links -}}
|
|
<tr>
|
|
<td>
|
|
{{- $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 -}}
|
|
<a href="{{ $matchedPage.RelPermalink }}">{{ $matchedPage.Title }}</a>
|
|
{{- else if $file -}}
|
|
<code>{{ $file }}{{ if $line }}:{{ $line }}{{ end }}</code>
|
|
{{- else if $pagePath -}}
|
|
<code>{{ $pagePath }}</code>
|
|
{{- else -}}
|
|
<em>Emplacement inconnu</em>
|
|
{{- end -}}
|
|
<br>
|
|
{{- end -}}
|
|
{{- else -}}
|
|
<em>Emplacements inconnus</em>
|
|
{{- end -}}
|
|
</td>
|
|
<td><a href="{{ .url }}" rel="noreferrer noopener" target="_blank">{{ .url }}</a></td>
|
|
<td>{{ with .code }}<code>{{ . }}</code>{{ end }}</td>
|
|
<td>{{ with .statusText }}<code>{{ . }}</code>{{ end }}</td>
|
|
</tr>
|
|
{{- end -}}
|
|
</tbody>
|
|
</table>
|