{{ define "main" }}

  <div id="page-header">
    <h1>{{ .Title }}</h1>
    {{ if .Params.subtitle }}
      <span class="subtitle">{{ .Params.subtitle }}</span>
    {{ end }}
    {{ with .Params.links }}
    <!-- <section id="quick-links"> -->
      <!-- <h2>Quick Links</h2> -->
      <div id="link-list">
        <ul>
          {{ range . }}
            <li><a href="{{ .url }}" target="_blank" rel="noopener">{{ if .icon }}<i class="{{ .icon }}"></i>&nbsp;&nbsp;{{ end }}{{ .title }}</a></li>
          {{ end }}
        </ul>
      </div>
    <!-- </section> -->
    {{ end }}
  </div>


  <section id="taxonomies">
    <h2>At a Glance</h2>
    <table id="taxonomy-table">
      <tbody>
        {{ $params := .Params }}
        {{ range $taxonomyname, $taxonomy := .Site.Taxonomies }}
          {{ $terms := index $params $taxonomyname }}
          {{ if $terms }}
          <tr>
            <td>
              <a 
              class="taxonomy-name" 
              href="{{ "/" | relLangURL }}{{ $taxonomyname }}">
              {{ $taxonomyname | strings.FirstUpper }}
            </a>
          </td>
          <td>
            {{ range $term := $terms }}
              {{ partial "term-link.html" (dict "name" $term "taxonomy" $taxonomyname) }}
            {{ end }}
          </td>
        </tr>
        {{ end }}
        {{ end }}
      </tbody>
    </table>
  </section>

  {{ if .Content }}
  <section>
    <h2>Description</h2>
    {{ .Content }}
  </section>
  {{ end }}
  
  {{ with .Params.publications}}
  <section id="publications">
    <h2>Publications</h2>
    <ul>
      {{ range $citation, $pub := site.Data.publications }}
      {{ range $pub }}
      {{ if in $.Params.publications .key }}
      <li>
        {{ if .title }} <strong>{{ .title }}</strong> {{ end }}
        {{ if .year }}
        {{ if .month }}
          ({{ .month }} {{.year }}) 
        {{ else }}
          ({{ .year }}) 
        {{ end }}
        {{ end }}
        {{ if .author }} by {{ index .author 0 }}{{ if (gt (len .author) 1) }} et. al. {{ end }}{{ end }}
        {{ if .booktitle }}  | Appears in <em>{{ .booktitle }}</em> {{ end }}
        {{ if .pages }} ({{ .pages }}) {{ end }}
        {{ if .journal }}  | Appears in <em>{{ .journal }}</em> {{ end }}
        {{ if .volume }} | Volume {{ .volume }} {{ end }}
        {{ if .publisher }}  | Published by {{ .publisher }} {{ end }}
        {{ if .doi }}  | <a href="https://doi.org/{{ .doi }}" target="_blank" rel="noopener">{{ .doi }}</a> 
        {{ else if .url }}  | <a href="{{ . }}" target="_blank" rel="noopener">{{ .url }}</a> {{ end }}
      </li>
      {{ end }}
      {{ end }}
      {{ end }}
    </ul>
  </section>
  {{ end }}

  {{ if .Date }}
  {{ $dateMachine := .Date | time.Format "2006-01-02T15:04:05-07:00" }}
  {{ $dateHuman := .Date | time.Format ":date_long" }}
  <p class="time">Updated <time datetime="{{ $dateMachine }}">{{ $dateHuman }}</time></p>
  {{ end }}


{{ end }}