Erstes Commit

This commit is contained in:
2026-02-19 18:37:05 +01:00
commit 74a5b5bbb7
97 changed files with 1792 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
{{ $basePath := "content/comics" }}
{{ range (os.ReadDir $basePath) }}
{{ if .IsDir }}
{{ $comicDir := .Name }}
{{ $fullPath := printf "%s/%s" $basePath $comicDir }}
{{ $indexContent := readFile (printf "%s/_index.md" $fullPath) }}
{{ $comicData := transform.Unmarshal $indexContent }}
{{ $images := slice }}
{{ range (os.ReadDir $fullPath) }}
{{ if findRE "\\.(jpg|jpeg|png|webp|gif)$" .Name }}
{{ $images = $images | append .Name }}
{{ end }}
{{ end }}
{{ $images = sort $images }}
{{ $imageCount := len $images }}
{{ range $index, $image := $images }}
{{ if gt $index 0 }}
{{ $pageNum := math.Add $index 1 }}
{{ $nextPage := "" }}
{{ $lastPage := "" }}
{{ if lt $pageNum $imageCount }}
{{ $nextPage = printf "../%d/" (math.Add $pageNum 1) }}
{{ $lastPage = printf "../%d/" $imageCount }}
{{ end }}
{{ $prevPage := "../" }}
{{ if gt $pageNum 2 }}
{{ $prevPage = printf "../%d/" $index }}
{{ end }}
{{ $page := dict
"path" (printf "%s/%d" $comicDir $pageNum)
"title" (printf "%s, Seite %d" $comicData.title $pageNum)
"description" $comicData.description
"params" (dict
"image" $image
"next" $nextPage
"prev" $prevPage
"last" $lastPage
)
}}
{{ $.AddPage $page }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}