{{- define "main" }}
  {{- $site := . }}
  {{- $author := (index .Site.Data.authors .Title) }}
  {{- with (index $author "orcid") }}
    <a href="{{ .url }}">
      <img alt="ORCID logo" src="https://info.orcid.org/wp-content/uploads/2019/11/orcid_16x16.png"
           width="16" height="16" />
      {{ .id }}
    </a>
  {{- end }}

  {{- with (index $author "homepages") }}
    <h2>Homepages 🌐</h2>
    <ul>
    {{- range . }}
      <li><a href="{{ . }}">{{ . }}</a></li>
    {{- end }}
    </ul>
  {{- end }}
  {{- with (index $author "emails") }}
    <h2>E-Mails 📧</h2>
    <ul>
    {{- range . }}
      <li>
        <a class="obfuscated" data="{{ . | jsonify | base64Encode }}">
          {{ partial "partials/email.html" . }}
        </a>
      </li>
    {{- end }}
    </ul>
  {{- end }}

  <h2>Entries</h2>
  {{- range (.Data.Pages).GroupByDate "2006" }}
    <h3 class="head">{{ .Key }}</h3>
    {{- range .Pages }}
      <article class="entry">
        <div class="item-text">
          <h5><a class="title" href="{{ .RelPermalink }}">{{ htmlUnescape .Title }}</a></h5>
          <br>
          {{- $entry := . }}
          {{- with .Params.authors }}
            by
            {{ partial "authors.html" (dict "site" $site "authors" . "affiliations"
               $entry.Params.affiliations) }}
          {{- end }}
        </div>
        <span class="date">
          {{ .Date.Format "Jan 02" }}
        </span>
      </article>
    {{- end }}
  {{- end }}
{{- end }}