{{ $posts := (where .Site.RegularPages "Section" "==" "post") }}{{ $postCount := len $posts }}{{if ge $postCount 4}}{{ $currentPage := . }}
<article class="read-next-card" {{if .Site.Params.cover}}
            style="background-image: url({{.Site.Params.cover | absURL}});" {{else}}style="background-color: #090a0b;"{{end}}>
    <header class="read-next-card-header">
        <small class="read-next-card-header-sitetitle">&mdash; {{.Site.Params.Title}} &mdash;</small>
        {{if .Params.tags }}{{ range $index, $tag := .Params.tags }}{{if lt $index 1}}
        <h3 class="read-next-card-header-title"><a href="{{$.Site.BaseURL}}tags/{{ $tag | urlize }}/">#{{$tag}}</a></h3>{{end}}{{end}}{{ end }}
    </header>
    <div class="read-next-divider"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 14.5s2 3 5 3 5.5-2.463 5.5-5.5S21 6.5 18 6.5c-5 0-7 11-12 11C2.962 17.5.5 15.037.5 12S3 6.5 6 6.5s4.5 3.5 4.5 3.5"/></svg>
    </div>

    <div class="read-next-card-content">
      {{ $shuffledposts := ($posts | shuffle) }}{{$.Scratch.Set "pc" 0}}
        <ul>{{range $shuffledposts}}{{if (lt ($.Scratch.Get "pc") 4)}}
          {{if (ne .Permalink $currentPage.Permalink)}}<li><a href="{{.Permalink}}">{{.Title}}</a></li>{{$.Scratch.Add "pc" 1}}{{end}}            
        {{end}}{{end}}</ul>
    </div>
    <footer class="read-next-card-footer">
      {{if .Params.tags }}{{ range $index, $tag := .Params.tags }}{{if lt $index 1}}
        <a href="{{$.Site.BaseURL}}tags/{{ $tag | urlize }}/">See all related posts →</a>{{end}}{{end}}{{ end }}
    </footer>
</article>
{{end}}
