diff --git a/layouts/_default/manga.html b/layouts/_default/manga.html new file mode 100644 index 0000000..ce05a63 --- /dev/null +++ b/layouts/_default/manga.html @@ -0,0 +1,117 @@ +{{ define "main" }} +{{ $apiURL := .Params.api }} +{{ $isGerman := eq .Site.Language.Lang "de" }} +{{ $loadingError := "" }} +{{ $ratingMax := 5 }} +{{ $items := slice }} + +{{ if $apiURL }} + {{ $remote := try (resources.GetRemote $apiURL (dict "headers" (dict "Accept" "application/json"))) }} + {{ if $remote.Err }} + {{ $loadingError = printf "%v" $remote.Err }} + {{ else }} + {{ with $remote.Value }} + {{ $payload := . | transform.Unmarshal }} + {{ with $payload.ratingMax }} + {{ $ratingMax = . }} + {{ end }} + {{ with $payload.items }} + {{ $items = sort . "updatedAt" "desc" }} + {{ end }} + {{ end }} + {{ end }} +{{ end }} + +
+
+
+

{{ if $isGerman }}Bibliothek{{ else }}Library{{ end }}

+

{{ .Title }}

+

+ {{ if $isGerman }} + Mangas aus der eigenen Bibliothek. + {{ else }} + Manga from your own library. + {{ end }} +

+
+
+ {{ len $items }} {{ if $isGerman }}Bände{{ else }}volumes{{ end }} +
+
+ +
+ {{ if $loadingError }} +
+ {{ if $isGerman }} + Die Bibliothek konnte beim Build nicht geladen werden. + {{ else }} + The library could not be loaded during build. + {{ end }} +
+ {{ else if eq (len $items) 0 }} +
+ {{ if $isGerman }} + Noch keine gelesenen Mangas gefunden. + {{ else }} + No read manga found yet. + {{ end }} +
+ {{ else }} +
+ {{ range $items }} + {{ $item := . }} + {{ $authors := cond (gt (len .authors) 0) (delimit .authors ", ") (cond $isGerman "Unbekannt" "Unknown") }} + {{ $displayTitle := printf "%s - %s %s" .editionTitle (cond $isGerman "Band" "Vol.") .numberDisplay }} + {{ if .title }} + {{ $displayTitle = printf "%s - %s" $displayTitle .title }} + {{ end }} + {{ $cover := .cover }} + {{ if not $cover }} + {{ $cover = .editionCover }} + {{ end }} +
+
+ {{ if $cover }} + {{ $displayTitle }} + {{ else }} +
+ {{ end }} +
+
+

{{ .editionTitle }}

+

{{ $displayTitle }}

+

{{ $authors }}

+
+
+ +
+
+ {{ end }} +
+ {{ end }} +
+
+{{ end }}