{{ 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" ) ) }} {{ index . "Date Added" }} {{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}} {{ range . }} {{ end }} {{- end -}} {{ .Title }} {{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}} {{- end -}} {{ .Author }} {{ index . "Year Published" }} {{- if ( index . "Date Read" ) -}} {{- index . "Date Read" -}} {{- else -}} n/a {{- end -}} {{ end }}