{{ define "main" }}
<div class="container">
  <h1>Today I Learned</h1>

  <p>Debug Info:</p>
  <ul>
    <li>Total Pages: {{ len .Pages }}</li>
    <li>Is Section: {{ .IsSection }}</li>
    <li>Section Name: {{ .Section }}</li>
  </ul>

  {{ range .Pages }}
  <article>
    <h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
    <p>Date: {{ .Date.Format "January 2, 2006" }}</p>
    {{ with .Description }}
    <p>{{ . }}</p>
    {{ end }}
  </article>
  {{ end }}

  {{ if eq (len .Pages) 0 }}
  <p>No TIL posts found.</p>
  {{ end }}
</div>
{{ end }}