{{ partial "content_header.html" . }}

{{ partial "table_of_contents.html" . }}

{{- $layout := .Params.layout -}}
{{- $content := .Content -}}
{{ with $layout := .Params.layout }}
  <article class="{{ $layout }}">
    {{ $content }}
  </article>
{{ else }}
  {{ $content }}
{{ end}}

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

  {{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
  {{- if and (gt (len $pages) 1) (in $pages . ) -}}
    <nav class="post-nav">
      {{ with $pages.Prev . }}
        <a class="prev" href="{{ .Permalink }}"><span>←</span><span>{{ .Name }}</span></a>
      {{ end }}
      {{ with $pages.Next . }}
        <a class="next" href="{{ .Permalink }}"><span>{{ .Name }}</span><span>→</span></a>
      {{ end }}
    </nav>
  {{- end -}}
</footer>
