1
Files
2025/themes/2026/layouts/_partials/article-change-history.html

41 lines
1.6 KiB
HTML

{{- with .GitInfo -}}
{{- $history := slice . -}}
{{- range .Ancestors -}}
{{- $history = $history | append . -}}
{{- end -}}
{{- $repositoryURL := "" -}}
{{- $diffAnchor := "" -}}
{{- with $.Site.Params.repositoryURL -}}
{{- $repositoryURL = strings.TrimSuffix "/" (strings.TrimSpace .) -}}
{{- end -}}
{{- with $.File.Path -}}
{{- $diffAnchor = printf "#diff-%s" (sha1 (printf "content/%s" .)) -}}
{{- end -}}
{{- if gt (len $history) 0 -}}
<section class="article-aside-block article-change-history">
<h2>Historique des modifications</h2>
<ol>
{{- range $history -}}
{{- $commitURL := "" -}}
{{- if ne $repositoryURL "" -}}
{{- $commitURL = printf "%s/commit/%s%s" $repositoryURL .Hash $diffAnchor -}}
{{- end -}}
<li>
{{- if ne $commitURL "" -}}
<a href="{{ $commitURL }}" title="Consulter ce commit dans la forge" rel="noreferrer noopener">
<span class="article-change-history-subject">{{ .Subject }}</span>
<time datetime="{{ .CommitDate.Format "2006-01-02T15:04:05Z07:00" }}">{{ printf "%s à %s" (.CommitDate | time.Format "02/01/2006") (.CommitDate | time.Format "15:04") }}</time>
</a>
{{- else -}}
<div>
<span class="article-change-history-subject">{{ .Subject }}</span>
<time datetime="{{ .CommitDate.Format "2006-01-02T15:04:05Z07:00" }}">{{ printf "%s à %s" (.CommitDate | time.Format "02/01/2006") (.CommitDate | time.Format "15:04") }}</time>
</div>
{{- end -}}
</li>
{{- end -}}
</ol>
</section>
{{- end -}}
{{- end -}}