{{ if ( eq ( .Scratch.Get "listMode" ) "log" ) }}
  {{ if ( eq ( .Scratch.Get "listMode" ) "log" ) }}
    {{ .Scratch.Set "filterCol" "Date Watched" }}
    {{ .Scratch.Set "filterDir" "desc" }}
  {{ end }}

  {{ range ( sort ( index $.Site.Data.tv ( .Scratch.Get "listMode" ) ) ( .Scratch.Get "filterCol" ) ( .Scratch.Get "filterDir" ) ) }}
  <tr>
    <td>
      {{- partial "cite" ( dict "c" . "schemaType" "TVSeries" "title" ( index . "Series Title" ) ) -}}
    </td>
    <td>
      {{- partial "cite" ( dict "c" . "schemaType" "TVEpisode" "title" ( index . "Episode Title" ) ) -}}
      <span class="episode-number">({{ index . "Episode Number" }})</span>
    </td>
    <td>
    {{- if ( index . "Date Watched" ) -}}
      {{- time.Format "Jan 2, 2006" ( index . "Date Watched" ) -}}
      {{- if .Rewatch }} &#x21BB;{{ end -}}
    {{- else -}}
      n/a
    {{- end -}}
    </td>
  </tr>  
  {{ end }}
{{ end }}
