{{ $page := .page }}
{{ cond (and $page.IsNode (not .forceFile)) "drwxr-xr-x" "-rw-r--r--" }}
{{/* Nombre d'éléments dans le nœud, sinon 1 si c'est un fichier. */}}
{{ cond (and $page.IsNode (not .forceFile)) (len $page.Pages) "1" }}
{{/* La taille d'un répertoire est 4Kio. */}}
{{ $bytes := int (cond $page.IsNode (cond .forceFile (len $page.Content) 4096) $page.Len) }}
{{/* log(0) vaut -inf., donc on force base à 0 dans ce cas. */}}
{{ $base := cond (eq $bytes 0) 0 (int (div (math.Log $bytes) (math.Log 1024))) }}
{{ $divider := float (math.Pow 1024 $base) }}
{{ $value := div $bytes $divider }}
{{ $unit := index (slice "" "K" "M" "G") $base }}
{{ if eq $base 0 }}
{{ $bytes }}
{{ else if lt $value 10 }}
{{ lang.FormatNumber 1 $value }}{{ $unit }}
{{ else }}
{{ lang.FormatNumber 0 (math.Round $value) }}{{ $unit }}
{{ end }}
{{/* cond $page.IsNode (cond .forceFile (len $page.Content) "4096") $page.Len */}}
{{ with (or $page.PublishDate $page.Lastmod) }}
{{ .Day }}
{{ .Format "Jan" }}
{{/* Si l'élément est modifié depuis plus de 6 mois on affiche l'année, sinon l'heure */}}
{{ if gt (time.Now.Sub .) (duration "hour" (mul 6 30 24)) }}
{{ .Year }}
{{ else }}
{{ . | time.Format ":time_short" }}
{{ end }}
{{ end }}
{{ or .linkTitle (print $page.File.BaseFileName "." $page.File.Ext) $page.LinkTitle }}{{ cond (and $page.IsNode (not .forceFile)) "/" "" }}
{{/* vim: set tw=80 ts=2 sw=2 sts=2 ft=gohtmltmpl: */}}