{{ define "main" }}
<article>
  <div class="post-header">
    <h1>{{ .Title }}</h1>
    <div class="post-meta">
      <span>{{ .Site.Params.author | upper }}</span>
      <span class="separator">·</span>
      <time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "02 Jan 2006" }}</time>
      {{- with .Params.tags }}
      <span class="separator">|</span>
      <span class="post-tags">
        {{- range . }}
        <a href="/posts/?tag={{ . | urlize }}" class="post-tag">#{{ . }}</a>
        {{- end }}
      </span>
      {{- end }}
    </div>
  </div>

  {{- $seriesTerms := .GetTerms "series" }}
  {{- if $seriesTerms }}
  {{- $series := index $seriesTerms 0 }}
  <div class="series-nav">
    <p>This post is a part of the <strong>{{ $series.Title }}</strong> series:</p>
    <ul class="series-list">
      {{- range $series.Pages.Reverse }}
      <li>
        {{- if eq .Permalink $.Permalink }}
        <span class="current-series-item">→ {{ .Title }}</span>
        {{- else }}
        <a href="{{ .Permalink }}">{{ .Title }}</a>
        {{- end }}
      </li>
      {{- end }}
    </ul>
  </div>
  {{- end }}

  <div class="post-content">
    {{- if and (ne .Params.toc false) (gt (len .TableOfContents) 32) }}
    <details class="post-toc" open>
      <summary class="toc-title">Table of Contents</summary>
      {{ .TableOfContents }}
    </details>
    {{- end }}
    {{ .Content }}
  </div>
  <hr>
  <a href="/" class="back-link">← back to home</a>
</article>
{{ end }}
