davideisinger.com

My personal website
Log | Files | Refs | README

header.html (1349B)


      1 {{ $latestTrack := false }}
      2 {{ range (where .Site.RegularPages "Params.exclude_music" "!=" true).ByDate.Reverse }}
      3   {{ $page := . }}
      4   {{ with first 1 (sort (.Resources.Match "*.mp3") "Title" "desc") }}
      5     {{ $latestTrack = dict "track" (index . 0) "page" $page }}
      6     {{ break }}
      7   {{ end }}
      8 {{ end }}
      9 
     10 <header id="site-header" class="home-intro{{ if $latestTrack }} home-intro-with-music{{ end }}">
     11   <h1 class="home-name"><a href="/">{{ .Site.Title }}</a></h1>
     12   <div class="home-bio">
     13     {{ .Site.Home.Content }}
     14   </div>
     15   <p class="home-about">
     16     <a href="/about/">More about me →</a>
     17     <a href="https://dispatch.davideisinger.com/subscription/form">Subscribe via email →</a>
     18   </p>
     19 
     20   {{ with $latestTrack }}
     21     {{ $title := substr .track.Title 0 -4 }}
     22     <h2 class="home-music-heading home-music-cell" id="latest-track-heading" aria-live="polite">Latest track</h2>
     23     <div class="home-music home-music-cell" role="group" aria-labelledby="latest-track-heading">
     24       <p class="track-title">{{ $title }}</p>
     25       <p class="track-source">From <a href="{{ .page.RelPermalink }}">{{ .page.Title }}</a></p>
     26       <audio controls preload="metadata" aria-label="{{ $title }}" src="{{ .track.RelPermalink }}"></audio>
     27     </div>
     28     <p class="more-music home-music-cell"><a href="/music/">More music →</a></p>
     29   {{ end }}
     30 </header>