{{ define "main" }}
  <header class="mw7 center">
    <h2 class="baskerville f2 lh-title mv3 ph1">
      {{ .Title }}
    </h2>

    {{ with .Params.subtitle }}
      <h3 class="f3 baskerville mv3 pa1">{{ . }}</h3>
    {{ end }}

    {{ $image := "" }}
    {{ if resources.Get (index .Params.images 0) }}
      {{ $image =  resources.Get (index .Params.images 0) }}
    {{ else if (.Resources.ByType "image").GetMatch "*featured*" }}
      {{ $image =  (.Resources.ByType "image").GetMatch "*featured*" }}
    {{ end }}
    {{ with $image }}
      {{ $image := .Fit (default "400x400" $.Params.image_size) }}
      <div class="tc">
        <div class="relative dib">
          <img src="{{ $image.RelPermalink }}" class="ma0" alt="{{ .Title }}" />
          {{ with $.Params.caption }}
            <a
              href="{{ .url }}"
              class="link near-white db absolute bottom-0 right-0 pa2 bg-black-30 br2"
            >
              {{ .text }}
            </a>
          {{ end }}
        </div>
      </div>
    {{ end }}

    {{ if in (slice "post" "talk") .Section }}
      {{ partial "metadata.html" . }}
    {{ end }}
  </header>
  <div class="main-content mw7 center lh-copy f5 f4-ns ph1">
    {{ .Content }}
  </div>
  <div class="f5 f4-ns lh-copy pv2">
    {{ if in (slice "post" "talk") .Section }}
      {{ partial "author_card" . }}
    {{ end }}
    {{ partial "post_pager" . }}
  </div>
{{ end }}