  {{- $maxBlogPosts := .Site.Params.maxBlogPosts }}
  {{/*expTimestamp: expire content every 1hour (6000s)*/}}
  {{- $expTimestamp := div now.Unix 6000 }}
  {{- $mediumURL    := printf "https://api.rss2json.com/v1/api.json?timestamp=%d&rss_url=https://medium.com/feed/kialiproject" $expTimestamp }}
  {{- $json         := getJSON $mediumURL }}
  {{- $posts        := first $maxBlogPosts $json.items }}
  {{- $latestPost   := index $json.items 1 }}

  <section id="blog-latest" data-lastpubat="{{ $latestPost.pubDate }}">
    <h1>
      Latest in our blog
    </h1>
    <div id="go-to-blog-link">
      <a href="https://medium.com/kialiproject" target="_blank">
        Go to blog
        <span class="fas fa-external-link-alt" />
      </a>
    </div>

    <div id="blog-blocks">
      {{ range $posts }}
        {{ $link    := .link }}
        {{ $img     := .thumbnail }}
        {{ $title   := .title }}
        {{ $author  := .author }}
        {{ $dateRaw := .pubDate }}
        {{ $date    := dateFormat "January 2, 2006" $dateRaw }}
        {{ $summary := .content | plainify | truncate 150 }}

        <a href="{{ $link }}" title="{{ $title }}" target="_blank">
          <div>
            <header>
              <div>{{ $date }}</div>
              <div><span class="fas fa-book" /></div>
            </header>
            <h1>{{ $title }}</h1>
            <p>{{ $author }}</p>
          </div>
        </a>
      {{ end }}
    </div>
  </section>

