{{ $basePath := "content/gameplays" }} {{ $site := .Site }} {{ range (os.ReadDir $basePath) }} {{ if .IsDir }} {{ $gameplayDir := .Name }} {{ $fullPath := printf "%s/%s" $basePath $gameplayDir }} {{ $indexContent := readFile (printf "%s/_index.md" $fullPath) }} {{ $indexParts := split $indexContent "---" }} {{ $gameplayData := index $indexParts 1 | transform.Unmarshal }} {{ $gameplayBody := index $indexParts 2 }} {{ $episodeCount := len $gameplayData.episodes }} {{ range $index, $episode := $gameplayData.episodes }} {{ if gt $index 0 }} {{ $pageNum := math.Add $index 1 }} {{ $content := dict "mediaType" "text/markdown" "value" $gameplayBody }} {{ $episodeName := "" }} {{ if $episode.title }} {{ $episodeName = $episode.title }} {{ end }} {{ $page := dict "path" (printf "%s/%d" $gameplayDir $pageNum) "title" (printf "%s, Folge %d" $gameplayData.title $pageNum) "description" $episode.description "content" $content "params" (dict "video" $episode.video "gameplay" $gameplayData.fullname "name" $episodeName "index" $index "episodes" $gameplayData.episodes ) }} {{ $.AddPage $page }} {{ end }} {{ end }} {{ end }} {{ end }}