add slugs, fix tables

This commit is contained in:
Ben Goldsworthy 2025-01-17 02:05:51 +01:00
parent 0d44f0764e
commit eff55debea
No known key found for this signature in database
23 changed files with 90 additions and 70 deletions

View file

@ -3,49 +3,47 @@
{{- $log_file := index ( index $.Site.Data $section ) $list_mode -}}
{{- if $log_file -}}
{{- $total := len $log_file -}}
{{- $total := len $log_file -}}
{{- $today := time.Now -}}
{{- $today := time.Now -}}
{{-
$this_year_total := (
where (
where $log_file "date_finished" "gt" (
( $today.AddDate -1 0 0 ).Format "2006-01-02"
)
) "date_finished" "lt" ( $today.Format "2006-01-02" )
) | len
-}}
{{- $this_year_total := (
where (
where $log_file "date_finished" "gt" (
( $today.AddDate -1 0 0 ).Format "2006-01-02"
)
) "date_finished" "lt" ( $today.Format "2006-01-02" )
) | len
-}}
{{-
$this_quarter_total := (
where (
where $log_file "date_finished" "gt" (
( $today.AddDate 0 -3 0 ).Format "2006-01-02"
)
) "date_finished" "lt" ( $today.Format "2006-01-02" )
) | len
-}}
{{-
$this_month_total := (
where (
where $log_file "date_finished" "gt" (
( $today.AddDate 0 -1 0 ).Format "2006-01-02"
)
) "date_finished" "lt" ( $today.Format "2006-01-02" )
) | len
-}}
{{- $this_quarter_total := (
where (
where $log_file "date_finished" "gt" (
( $today.AddDate 0 -3 0 ).Format "2006-01-02"
)
) "date_finished" "lt" ( $today.Format "2006-01-02" )
) | len
-}}
{{- $this_month_total := (
where (
where $log_file "date_finished" "gt" (
( $today.AddDate 0 -1 0 ).Format "2006-01-02"
)
) "date_finished" "lt" ( $today.Format "2006-01-02" )
) | len
-}}
<details class="log-stats">
<summary>Summary</summary>
<div>
<p>Total: {{ lang.FormatNumber 0 $total }}</p>
{{- if eq $list_mode "log" -}}
<p>Last 12 months: {{ lang.FormatNumber 0 $this_year_total }}</p>
<p>Last 3 months: {{ lang.FormatNumber 0 $this_quarter_total }}</p>
<p>Last month: {{ lang.FormatNumber 0 $this_month_total }}</p>
{{- end -}}
</div>
</details>
<details class="log-stats">
<summary>Summary</summary>
<div>
<p>Total: {{ lang.FormatNumber 0 $total }}</p>
{{- if eq $list_mode "log" -}}
<p>Last 12 months: {{ lang.FormatNumber 0 $this_year_total }}</p>
<p>Last 3 months: {{ lang.FormatNumber 0 $this_quarter_total }}</p>
<p>Last month: {{ lang.FormatNumber 0 $this_month_total }}</p>
{{- end -}}
</div>
</details>
{{- end -}}