{{/* this is used to list all the books and syyj-episodes from a reader */}}

{{ if .Params.list_books }}
{{ $reader := .Params.reader }}

{{/* reference
- https://stackoverflow.com/a/71562439
*/}}
{{ $allBooks := where .Site.RegularPages "Section" "books" }}
{{ $allEpisodes := $allBooks | union (where .Site.RegularPages "Section" "syyj") }}
{{ $episodes := where $allEpisodes "Params.reader" "eq" $reader }}

{{ if ge (len $episodes) 1 }}
<h2>朗读作品</h2>

{{ range $episodes }}
<ul><li>
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
</li></ul>
{{ end }}

{{ end }}

{{ end }}