{{ define "main" }}
  {{ 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 -->
  {{ partial "list-to-carousel.html" .Content }}

  <!-- Carousel CSS & JS -->
  <link rel="stylesheet" href="/css/auto-carousel.css">
  <script type="text/javascript" src="/js/auto-carousel.js"></script>

  <div class="time">
    {{ partial "date.html" .Date }}
    {{ $showReadingTime := .Params.showreadingtime | default site.Params.showreadingtime | default true }}
    {{ if and $showReadingTime .ReadingTime }}
      <span class="reading-time"> · {{ .ReadingTime }} min read</span>
    {{ end }}
    {{ $showLastMod := .Params.showlastmod | default site.Params.showlastmod | default false }}
    {{ if and $showLastMod .Lastmod }}
      {{ if ne .LastMod.Format "2006-01-02" .Date.Format "2006-01-02" }}
        <span class="lastmod"> · Last updated: {{ .LastMod.Format "2006-01-02" }}</span>
      {{ end }}
    {{ end }}
  </div>

  <!-- Comments block -->
  {{ if and .Content (default true (default .Site.Params.comments
    .Params.comments))
  }}
    <div class="comments">{{- partial "comments" . -}}</div>
  {{ end }}

  {{ if not .IsHome }}
    <div class="terminal-nav">
      <div class="back-nav">
        {{ with .Parent }}
          <a href="{{ .RelPermalink }}" class="back-link">../</a>
        {{ else }}
          <a href="{{ "/" | relURL }}" class="back-link">../</a>
        {{ end }}
      </div>
    </div>
  {{ end }}
{{ end }}
