<!DOCTYPE html>
<html lang="en">
  {{- partial "head.html" . -}}
<body>
  <main class="main-home" style="display: flex; justify-content: space-around; flex-wrap: wrap; max-width: calc(100vw - 10px)">
    <div class="h-card">
      <!-- avator -->
      <div class="avatar">
        {{ $profile_image := resources.Get (printf "img/%s" .Site.Params.avatar) }}
        {{ $profile_width := 250 }}
        {{ $profile_image := $profile_image.Resize (printf "%dx webp q75" $profile_width) }}
        <img class="avatarMask u-photo" width="{{ $profile_width }}" height="{{ $profile_width }}" src="{{ $profile_image.RelPermalink }}" alt="Photo of {{ .Site.Params.Author }}">
        <!-- <img src="{{ .Site.BaseURL }}img/avatar-border.svg" alt="Photo of {{ .Site.Params.Author }}"> -->
      </div>
      <!-- author -->
      <h1 class="author title p-name">{{ .Site.Params.Author }}</h1>
      <a style="display: none" rel="me" class="u-url" href="{{ .Site.BaseURL }}"></a>
      <!-- description -->
      <p class="p-note">
        {{ .Site.Params.description | safeHTML }}
      </p>
      <!-- Site Navigation -->
      <nav class="nav-home">
        <ul class="space-evenly">
          {{ range .Site.Menus.main }}
            <li><a href="{{ .URL }}" aria-label="{{ .Identifier }}">{{ .Pre }}<br>{{ .Name }}</a></li>
          {{ end }}
        </ul>
      </nav>
      <!-- Social Navigation -->
      <p>You can also find me on:</p>
      <nav class="nav-home">
        <ul class="space-evenly">
          {{ range .Site.Menus.profile }}
            <li><a href="{{ .URL }}" rel="me" aria-label="{{ .Identifier }}">{{ .Pre }}<br>{{ .Name }}</a></li>
          {{ end }}
        </ul>
      </nav>
    </div>
    <div style="text-align: left; max-width: 750px">

      <h2>Latest Updates</h2>

      {{ $items := (where site.RegularPages "Type" "blog").ByDate }}
      {{ range last 1 $items }}
        <p><strong>Blog Post: </strong><a href="{{ .Permalink }}">{{ .Title }}</a></p>
      {{ end }}

      {{ $items := (where site.RegularPages "Type" "paper").ByDate }}
      {{ range last 1 $items }}
        <p><strong>Publication: </strong><a href="{{ .Permalink }}">{{ .Title }}</a></p>
      {{ end }}

      {{ $items := (where site.RegularPages "Type" "tracks").ByDate }}
      {{ range last 1 $items }}
        <p><strong>Recorded Walk: </strong><a href="{{ .Permalink }}">{{ .Title }}</a></p>
      {{ end }}

      {{ $data := getJSON "https://en.wikipedia.org/w/api.php?action=query&format=json&list=usercontribs&ucuser=BrandonRozek&uclimit=1" }}
      {{ range first 1 $data.query.usercontribs }}
        <p><strong>Last Wikipedia Edit: </strong><a href="https://en.wikipedia.org/?curid={{ .pageid }}">{{ .title }}</a></p>
      {{ end }}


      {{ $items := (where site.RegularPages "Type" "observations").ByDate }}
      {{ range last 1 $items }}
        {{ $name := "" }}
        {{ if (ne .Params.taxon.common_name "") }}
            {{ $name = .Params.taxon.common_name }}
        {{ else }}
            {{ $name = .Params.taxon.name }}
        {{ end }}
        <p><strong>Nature Observation: </strong><a href="{{ .Permalink }}">{{ title $name }}</a></p>
      {{ end }}


      {{ $items := (where site.RegularPages "Type" "menu").ByDate }}
      {{ range last 1 $items }}
        <p><strong>Recipe: </strong><a href="{{ .Permalink }}">{{ .Title }}</a></p>
      {{ end }}




    </div>
  </main>
  {{ partial "footer.html" . -}}
  <script type="application/ld+json">
    {
      "@context": "http://schema.org",
      "@type": "WebSite",
      "url": "{{ .Permalink }}"
    }
  </script>
</body>
</html>