Cataloguer/layouts/partials/books/table-body.html
2022-12-17 12:41:44 -06:00

33 lines
978 B
HTML

{{ if ( eq ( .Scratch.Get "listMode" ) "log" ) }}
{{ .Scratch.Set "filterCol" "Date Read" }}
{{ .Scratch.Set "filterDir" "desc" }}
{{ else }}
{{ .Scratch.Set "filterCol" "Title" }}
{{ .Scratch.Set "filterDir" "asc" }}
{{ end }}
{{ range ( sort ( sort ( index $.Site.Data.books ( .Scratch.Get "listMode" ) ) "Title" "asc" ) ( .Scratch.Get "filterCol" ) ( .Scratch.Get "filterDir" ) ) }}
<tr>
<td>{{ index . "Date Added" }}</td>
<td>
{{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}}
{{ range . }}
<a href="{{ .RelPermalink }}">
{{ end }}
{{- end -}}
<cite class="film">{{ .Title }}</cite>
{{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}}
</a>
{{- end -}}
</td>
<td>{{ .Author }}</td>
<td>{{ index . "Year Published" }}</td>
<td>
{{- if ( index . "Date Read" ) -}}
{{- index . "Date Read" -}}
{{- else -}}
n/a
{{- end -}}
</td>
</tr>
{{ end }}