{{- $maxBlogPosts := 5 }}
{{- $expTimestamp := div now.Unix 6000 }}
{{- $sprintURL    := printf "https://api.rss2json.com/v1/api.json?timestamp=%d&rss_url=https://www.youtube.com/feeds/videos.xml?playlist_id=PLgwrCYrAkQYOHIeGukEZUmNRGbqI9uwpi" $expTimestamp }}
{{- $json         := getJSON $sprintURL }}
{{- $vids         := first $maxBlogPosts $json.items }}

<section id="video-sprint-demo" class="video-section">
    <h1>
        Sprint demo videos
        <span class="go-to-videos-link">
          <a href="https://www.youtube.com/playlist?list=PLgwrCYrAkQYOHIeGukEZUmNRGbqI9uwpi" target="_blank">
            Go to videos
            <span class="fas fa-external-link-alt"/>
          </a>
        </span>
    </h1>

    <div id="sprint-videos" class="new-embed-video-links">
      {{ range $vids }}
        {{ $link    := .link }}
        {{ $img     := .thumbnail }}
        {{ $title   := .title }}
        {{ $dateRaw := .pubDate }}
        {{ $vidId   := index (split .guid ":") 2 }}
        {{ $date    := dateFormat "January 2, 2006" $dateRaw }}

        <div class="video-card">
            <header class="video-header">
              <span class="video-text">{{ $date }}</span>
                <span class=" video-text video-icon"><span class="fas fa-video"/></span>
            </header>
            <p class="video-text video-title">{{ $title }}</p>
            <iframe class="video-iframe-links" src="https://www.youtube.com/embed/{{ $vidId }}"></iframe>
        </div>
      {{ end }}
    </div>

</section>
