{{ define "main" }}
  <h1>{{ .Title }}</h1>
  
  <div class="post-meta">
    {{ partial "date.html" .Date }} • {{ .WordCount }} words • {{ .ReadingTime }} min read
  </div>
  
  {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }}

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

  {{ .Content }}

  <div class="post-nav">
    {{ with .PrevInSection }}
      <div class="post-nav-prev">
        <a href="{{ .RelPermalink }}" rel="prev">← {{ .Title }}</a>
      </div>
    {{ end }}
    {{ with .NextInSection }}
      <div class="post-nav-next">
        <a href="{{ .RelPermalink }}" rel="next">{{ .Title }} →</a>
      </div>
    {{ end }}
  </div>
{{ end }}