{{ define "title" -}}
  Blog List | {{ .Site.Title }}
{{- end }}
{{ define "header" }}
  {{ partial "masthead.html" . }}
{{ end }}
{{ define "main" }}
  <header>
    <h1>{{ .Title }}</h1>
  </header>
  
  <section>
    {{ $prev := 3000}}
    {{range .Site.RegularPages}}
      {{if .Date}}
      {{if gt $prev (.Date.Format "2006")}}
      {{ if ne $prev 3000}}
        </tbody>
        </table>
      {{ end }}
      <table class="all-posts">
      <col width="15%">
      <col width="85%">
      <thead>
      <tr><td></td><td>{{ .Date.Format "2006" }}</td></tr>
      </thead>
      <tbody>
      {{end}}
      <tr>
        <th>{{.Date.Format "02 Jan"}}</th>
        <td><a href="{{.Permalink}}">{{.Title}}</a> {{if .Draft}}(draft){{end}}</td>
      </tr>
      {{ $prev = .Date.Format "2006"}}
      {{end}}
    {{end}}
  </table>    
  </section>

{{ end }}
{{ define "footer" }}
  {{ partial "powered-by.html" . }}
{{ end }}
