{{ define "main" }}
  <article class="single">
    <header class="single-header">
      <h1>{{ .Title }}</h1>
      {{ with .Params.summary }}<p class="single-summary">{{ . }}</p>{{ end }}
    </header>

    {{ $hasToC := .Params.toc | default false }}
    {{ $headers := findRE "<h[2-6]" .Content }}
    {{ if and $hasToC (ge (len $headers) 2) }}
      <nav class="toc">
        <strong>Inhalt</strong>
        <div class="toc-content">{{ .TableOfContents }}</div>
      </nav>
    {{ end }}

    <div class="single-content">
      {{ .Content }}
    </div>

    {{/* Fuss: Gruppe + weitere Einträge derselben Gruppe + bearbeiten. */}}
    {{ $g := .Params.group | default "Allgemein" }}
    {{ $siblings := where (where site.RegularPages "Section" "library") "Params.group" (.Params.group) }}
    <div class="entry-foot">
      <span class="entry-more">
        <strong>{{ $g }}</strong>
        {{ $others := slice }}
        {{ range $siblings }}{{ if ne .RelPermalink $.RelPermalink }}{{ $others = $others | append . }}{{ end }}{{ end }}
        {{ with $others }} · {{ range $i, $p := . }}{{ if $i }} · {{ end }}<a href="{{ $p.RelPermalink }}">{{ $p.LinkTitle }}</a>{{ end }}{{ end }}
      </span>
      {{ if .Lastmod }}<span>Zuletzt bearbeitet am {{ .Lastmod.Format "02.01.2006" }}</span>{{ end }}
      {{ with .File }}<a href="{{ site.Params.repoURL }}/_edit/branch/main/content/{{ .Path }}" rel="nofollow">bearbeiten ↗</a>{{ end }}
    </div>
  </article>
{{ end }}
