summaryrefslogtreecommitdiffstats
path: root/layouts/home.html
blob: 0beae1fbb0144fe4bbd449cd9e5d98a320824a1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{{ define "main" }}
  {{ partial "hero.html" . }}

  <div class="container feed-section">
    {{ $posts := where site.RegularPages "Type" "in" (slice "articles") }}
    {{ $posts := sort $posts "Params.date" "desc" }}

    {{ $featured := where $posts "Params.featured" true }}
    {{ $notFeatured := where $posts "Params.featured" "!=" true }}

    <div class="feed-grid">
      {{ if $featured }}
        <div class="feed-label">Featured</div>
        {{ range first 1 $featured }}
          {{ $data := dict "title" .Title "type" .Params.type "description" .Summary "date" .Date "url" .RelPermalink "image" .Params.image "featured" true }}
          {{ partial "post-card.html" $data }}
        {{ end }}
      {{ end }}

      {{ if or $featured $notFeatured }}
        {{ if $featured }}<div class="feed-label" style="margin-top: 2rem;">Latest</div>{{ else }}<div class="feed-label">Latest</div>{{ end }}
        {{ $latest := first 3 $notFeatured }}
        {{ range $latest }}
          {{ $data := dict "title" .Title "type" .Params.type "description" .Summary "date" .Date "url" .RelPermalink "image" .Params.image "featured" false }}
          {{ partial "post-card.html" $data }}
        {{ end }}
      {{ end }}
    </div>

    <a href="/articles/" class="feed-cta">View all articles</a>
  </div>
{{ end }}