Ajout d'un bloc d'historique de modifications
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
{{- $commentsMarkup := strings.TrimSpace (partial "asides/comments.html" .) -}}
|
||||
{{- $keywordsMarkup := strings.TrimSpace (partial "asides/keywords.html" .) -}}
|
||||
{{- $changeHistoryMarkup := strings.TrimSpace (partial "article-change-history.html" .) -}}
|
||||
{{- $furtherReadingMarkup := strings.TrimSpace (partial "article-further-reading.html" .) -}}
|
||||
{{- $relatedMarkup := strings.TrimSpace (partial "article-related.html" .) -}}
|
||||
{{- if or (ne $commentsMarkup "") (ne $keywordsMarkup "") (ne $furtherReadingMarkup "") (ne $relatedMarkup "") -}}
|
||||
{{- if or (ne $commentsMarkup "") (ne $keywordsMarkup "") (ne $changeHistoryMarkup "") (ne $furtherReadingMarkup "") (ne $relatedMarkup "") -}}
|
||||
<section class="article-asides">
|
||||
{{- with $commentsMarkup -}}
|
||||
{{- . | safeHTML -}}
|
||||
@@ -16,5 +17,8 @@
|
||||
{{- with $relatedMarkup -}}
|
||||
{{- . | safeHTML -}}
|
||||
{{- end -}}
|
||||
{{- with $changeHistoryMarkup -}}
|
||||
{{- . | safeHTML -}}
|
||||
{{- end -}}
|
||||
</section>
|
||||
{{- end -}}
|
||||
|
||||
40
themes/2026/layouts/_partials/article-change-history.html
Normal file
40
themes/2026/layouts/_partials/article-change-history.html
Normal file
@@ -0,0 +1,40 @@
|
||||
{{- 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 -}}
|
||||
Reference in New Issue
Block a user