{{ define "header" }}
  {{ partial "header.html" . }}
{{ end }}

{{ define "main" }}
  {{- $photos := partial "photos/list.html" . -}}
  {{ if eq (len $photos) 0 }}
    {{ errorf "Missing photo from photos page %q" .Path }}
  {{ end }}

  {{ if eq (len $photos) 1 }}
    {{- $img := index $photos 0 -}}
    <figure>
      <img
        src="{{ $img.RelPermalink }}"
        {{ with $img.Params.alt }}
          alt="{{ . }}"
        {{ end }}
        height={{ $img.Height }}>
    </figure>

    <article>
      <h1>{{ .Title }}</h1>
      {{ .Content }}
    </article>

    {{- if .Params.photo_details | default true -}}
      {{- partial "photo_exif_table.html" $img.Exif -}}

      {{- if in ($.Site.BaseURL | string) "localhost" -}}
        {{- partial "development/photo_exif_table.html" $img.Exif -}}
      {{- end -}}
    {{- end -}}
  {{ else }}
    <figure>
      <ul class="carousel">
        {{- range $photos -}}
          <li>{{ . }}</li>
        {{- end -}}
      </ul>
    </figure>
  {{ end }}

  <footer>
    {{ partial "footer_tags.html" . }}
  </footer>
{{ end }}

{{ define "footer" }}
  {{ partial "footer.html" . }}
{{ end }}
