{{ define "header" }}
  {{ partial "page-header.html" . }}
  <script src="/js/shuffle.js"></script>
{{ end }}

{{ define "main" }}
  <article class="flex-l flex-wrap justify-between mw8 center ph3 ph4-ns">

    <header class="mt4 w-100">
      <h1 class="f1 mb1">
        {{- .Title -}}
      </h1>
      {{ if .Date }}
      <time class="f6 mv1 dib tracked" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">
        {{- .Date.Format "2006-01-02" -}}
      </time>
      {{ end }}
    </header>

    <section id="catalog" class="lh-copy f5 mid-gray pr4-l">
      {{- .Content -}}

      <h1 id="works">
        Projects, papers, and discussions
      </h1>

      <ul class="shuffle list pl0">
        {{ range $key, $val := .Site.Data.catalog }}
        <li id="{{ $key }}" class="mv2 cf">
          <a href="#{{ $key }}" class="no-underline">
            {{ if eq .kind "tweet"}}
            <i class="fa fa-twitter fa-fw" title="Tweet"></i>
            {{ else if eq .kind "post"}}
            <i class="fa fa-newspaper-o fa-fw" title="Post"></i>
            {{ else if eq .kind "paper"}}
            <i class="fa fa-file fa-fw" title="Paper"></i>
            {{ else if eq .kind "thesis"}}
            <i class="fa fa-graduation-cap fa-fw" title="Thesis"></i>
            {{ else if eq .kind "library"}}
            <i class="fa fa-gears fa-fw" title="Library"></i>
            {{ else if eq .kind "tool"}}
            <i class="fa fa-bicycle fa-fw" title="Tool"></i>
            {{ else if eq .kind "talk"}}
            <i class="fa fa-comment-o fa-fw" title="Talk"></i>
            {{ else if eq .kind "idea"}}
            <i class="fa fa-lightbulb-o fa-fw" title="Idea"></i>
            {{ else }}
            <i class="fa fa-question-circle fa-fw" title="Unknown"></i>
            {{ end }}
          </a>
          <span>
          {{ range .authors }}
            {{ if reflect.IsMap . }}
              {{ $author := index $.Site.Data.actors .name }}
              {{ if $author }}
              <span class="author">
                <a href="#{{ . }}">{{ $author.name }}</a> ({{ .type }})</span>
              {{ else }}
              <span class="author">{{ . | markdownify }}</span>
              {{ end }}
            {{ else }}
              {{ $author := index $.Site.Data.actors . }}
              {{ if $author }}
              <span class="author"><a href="#{{ . }}">{{ $author.name }}</a></span>
              {{ else }}
              <span class="author">{{ . | markdownify }}</span>
              {{ end }}
            {{ end }}
          {{ end }}
          </span>
          {{ if .location }}
          <a href="{{ .location }}"
             target="_blank" rel="noopener"
          ><span class="b mv0">{{ .title | markdownify }}</span></a>.
          {{ else }}
          <span class="b mv0">{{ .title | markdownify }}</span>.
          {{ end }}
          {{ with .year }}<span>{{ . }}</span>.{{ end }}
          {{ with .years }}<span>{{ index . 0 }} – {{ index . 1 }}</span>.{{ end }}
          <div class="pl4">
            {{ with .description }}<div>{{ . | markdownify }}</div>{{ end }}
            {{ with .image }}
            <a href="{{ . }}" target="_blank" rel="noopener">
              <img class="db mw5 fr-ns ml1-ns mb1-ns" src="{{ . }}" />
            </a>
            {{ end }}
            {{ with .additional_resources }}
            <div class="f6">
              <span class="b">Additional Resources</span>
              <ul>
                {{ range . }}
                <li><a href="{{ .url }}">{{ .label }}</a>{{ if .description }}: {{ .description }} {{ end }}</li>
                {{ end }}
              </ul>
            </div>
            {{ end }}
            {{ with .quotes }}
            <ul class="pl0">
              {{ range . }}
              <blockquote class="slimquote">{{ . | markdownify }}</blockquote>
              {{ end }}
            </ul>
            {{ end }}
          </div>
        </li>
        {{ end }}
      </ul>

      <h1 id="actors">
        People and groups
      </h1>

      <p class="mb4">
        The following people and groups are some of the key actors in this space
        due to their work highlighted above, which has been curated through
        contributions to the catalog from the community. Please note that you
        should not assume that they have endorsed the community's actions —
        we simply admire their work.
      </p>

      <ul class="shuffle grid gtc2 gtc3-l gg1 list pl0">
        {{ range $key, $val := .Site.Data.actors }}
        <li id="{{ $key }}">
          <img class="w4 br-100 ba" src="{{ .avatar }}" />
          <h3 class="f4 mv0">{{ .name }}</h3>
          {{ with .affiliation }}
          <div>{{ . }}</div>
          {{ end }}
          <div>
            {{ with .website }}
            <a href="{{ . }}"
               target="_blank" rel="noopener" title="Website"
               class="link-transition social link">
              <i class="fa fa-home"></i>
            </a>
            {{ end }}
            {{ with .mastodon }}
            <a href="{{ . }}"
              target="_blank" rel="noopener" title="Mastodon"
              class="link-transition social link">
              <i class="fa fa-mastodon"></i>
            </a>
            {{ end }}
            {{ with .twitter }}
            <a href="https://twitter.com/{{ . }}"
               target="_blank" rel="noopener" title="Twitter"
               class="link-transition social link">
              <i class="fa fa-twitter"></i>
            </a>
            {{ end }}
          </div>
        </li>
        {{ end }}
      </ul>

      <hr/>
      <div class="tr f5 mv1">
        We welcome your <a href="{{ .Site.Params.email }}">feedback</a>
        and <a href="{{ .Site.Params.source }}">contributions</a>.
      </div>
    </section>

    <aside class="w-third-l mt6-l">
      {{- partial "menu-contextual.html" . -}}
    </aside>

  </article>
{{ end }}
