add slugs, fix tables

This commit is contained in:
Ben Goldsworthy 2025-01-17 02:05:51 +01:00
parent 0d44f0764e
commit eff55debea
Signed by: Rumperuu
SSH key fingerprint: SHA256:v3uompaUiPqV2w1/AIRWBSQOxr2dntH9Xs/y8fDnUPU
23 changed files with 90 additions and 70 deletions

View file

@ -8,10 +8,7 @@
&__header {
& .section-nav {
padding-block-end: 1em;
& li {
float: left;
padding-inline: 1em;
}
}

View file

@ -1,5 +1,6 @@
---
title: Books
slug: books
---
Here you can record books that you read.

View file

@ -1,6 +1,7 @@
---
title: Currently Reading
weight: 4
slug: current
---
Here you can record books that you are currently reading.

View file

@ -1,6 +1,7 @@
---
title: Read
weight: 2
slug: log
---
Here you can record books that you have previously read.

View file

@ -1,6 +1,7 @@
---
title: To-Read
weight: 3
slug: wishlist
---
Here you can record books that you would like to read.

View file

@ -1,5 +1,6 @@
---
title: Films
slug: films
---
Here you can record films that you watch.

View file

@ -1,6 +1,7 @@
---
title: Watched
weight: 1
slug: log
---
Here you can record films that you have previously watched.

View file

@ -1,6 +1,7 @@
---
title: To-Watch
weight: 2
slug: wishlist
---
Here you can record films that you would like to watch.

View file

@ -1,5 +1,6 @@
---
title: Games
slug: games
---
Here you can record games that you play.

View file

@ -1,6 +1,7 @@
---
title: Currently Playing
weight: 1
slug: current
---
Here you can record games that you are currently playing.

View file

@ -1,6 +1,7 @@
---
title: Played
weight: 2
slug: log
---
Here you can record games that you have previously played.

View file

@ -1,6 +1,7 @@
---
title: To-Play
weight: 3
slug: wishlist
---
Here you can record games that you would like to play.

View file

@ -1,5 +1,6 @@
---
title: TV
slug: tv
---
Here you can record TV shows that you watch.

View file

@ -1,5 +1,6 @@
---
title: TV Episodes
slug: episodes
---
Here you can record TV show episodes that you watch.

View file

@ -1,7 +1,7 @@
---
title: Watched
slug: log
weight: 2
slug: log
---
Here you can record TV show episodes that you have previously watched.

View file

@ -1,5 +1,6 @@
---
title: TV Series'
slug: series
---
Here you can record TV series' that you watch.

View file

@ -1,6 +1,7 @@
---
title: Currently Watching
weight: 1
slug: current
---
Here you can record TV series' that you are currently watching.

View file

@ -1,6 +1,7 @@
---
title: Watched
weight: 2
slug: log
---
Here you can record TV series' that you have previously watched.

View file

@ -1,6 +1,7 @@
---
title: To-Watch
weight: 3
slug: wishlist
---
Here you can record TV series' that you have would like to watch.

View file

@ -1,5 +1,6 @@
{{ define "title" }}
{{ .Page.Title | plainify }} | {{ .Site.Title }}
{{ .Page.Title | plainify }} |
{{ .Site.Title }}
{{ end }}
{{ define "main-class" }}--list{{ end }}
@ -8,30 +9,34 @@
{{ define "item-type" }}{{ .Params.itemsType }}{{ end }}
{{ define "main-header" }}
<header class="site-content__header">
<h1 class="page-title">{{ .Title | safeHTML }}
{{ range .AlternativeOutputFormats -}}
<a href="{{ .RelPermalink }}">
<img class="feed-icon" src="/images/feed-icon.svg">
</a>
{{ end }}
</h1>
{{ .Content }}
</header>
<header class="site-content__header">
<h1 class="page-title">
{{ .Title | safeHTML }}
{{ range .AlternativeOutputFormats -}}
<a href="{{ .RelPermalink }}">
<img
class="feed-icon"
src="/images/feed-icon.svg"
/>
</a>
{{ end }}
</h1>
{{ .Content }}
</header>
{{ end }}
{{ define "main-body" }}
<main class="site-content__body">
{{ if .File }}
{{ if ( eq .File.Dir "log/" ) }}
{{ .Scratch.Set "listMode" "log" }}
{{ else if ( eq .File.Dir "wishlist/" ) }}
{{ .Scratch.Set "listMode" "wishlist" }}
{{ end }}
{{ if ( in "log/ wishlist/" .File.Dir ) }}
{{ partial "table" . }}
{{ end }}
{{ end }}
</main>
{{ define "main-body" }}
<main class="site-content__body">
{{ if .File }}
{{ if ( eq .File.Dir "log/" ) }}
{{ .Scratch.Set "listMode" "log" }}
{{ else if ( eq .File.Dir "wishlist/" ) }}
{{ .Scratch.Set "listMode" "wishlist" }}
{{ end }}
{{ if ( in "log/ wishlist/" .File.Dir ) }}
{{ partial "table" . }}
{{ end }}
{{ end }}
</main>
{{ end }}

View file

@ -50,6 +50,7 @@
{{ .Scratch.Set "page" .Page.Slug }}
{{ if ( in "current log wishlist" ( .Scratch.Get "page" ) ) }}
{{ .Scratch.Get .Page.Slug }}
{{ if ( eq ( .Scratch.Get "page" ) "current" ) }}
{{ .Scratch.Set "listMode" "current" }}
{{ else if ( eq ( .Scratch.Get "page" ) "log" ) }}

View file

@ -3,6 +3,8 @@
<th>Platform(s)</th>
<th>Release Year</th>
{{ if ( not ( eq ( .Scratch.Get "listMode" ) "wishlist" ) ) }}
<th>Level of Completion</th>
{{ if ( not ( eq ( .Scratch.Get "listMode" ) "current" ) ) }}
<th>Level of Completion</th>
{{ end }}
<th>Dates Played</th>
{{ end }}

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 -}}