{{ define "title" }}{{ .Params.fullname }}, Folge 1 :: {{ .Site.Title }}{{ end }}

{{ define "main" }}
	{{ $episodes := .Params.episodes }}
	{{ $episodeCount := len $episodes }}
	{{ $firstEpisode := index $episodes 0 }}
	{{ $gameplayPage := . }}
	<nav class="submenu box">
		<h2>Bereiche:</h2>
		<ul>
			{{ range .Parent.Pages }}
				{{ if .Eq $gameplayPage }}
					<li class="active">
				{{ else }}
					<li>
				{{ end }}
					<a href="{{ .RelPermalink }}">{{ .Title }}</a>
				</li>
			{{ end }}
		</ul>
	</nav>
	<h1>{{ .Params.fullname }}</h1>
	{{ if $firstEpisode.title }}
		<h2>{{ $firstEpisode.title }}</h2>
	{{ end }}
	{{ if $firstEpisode.description }}
		<p>{{ $firstEpisode.description }}</p>
	{{ end }}
	<p><video src="{{ $firstEpisode.video }}" type="video/mp4" playsinline controls style="width:100%; aspect-ratio:16 / 9; display:block;"></video></p>
	{{ if gt $episodeCount 1 }}
		<div class="box videos">
			{{ range $index, $episode := $episodes }}
				{{ $episodeNum := math.Add $index 1 }}
				{{ if eq $index 0 }}
					<div class="active">
						<a href="./">Folge 01 – {{ $episode.title }}</a>
					</div>
				{{ else }}
					<div>
						<a href="{{ $episodeNum }}/">Folge {{ printf "%02d" $episodeNum }} – {{ $episode.title }}</a>
					</div>
				{{ end }}
			{{ end }}
		</div>
	{{ end }}
	{{ .Content }}
{{ end }}