summaryrefslogtreecommitdiffstats
path: root/layouts/home.html
blob: 54d808793a317c6fcd21abe577d1f750a48ade17 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{{ define "canvas-mode" }}hero{{ end }}

{{ define "main" }}
  {{ partial "hero.html" . }}

  <section id="articles" class="section-container reveal-group"
           style="background: var(--bg2); padding: 6rem 2rem;">

    <div class="section-header">
      <p class="section-eyebrow">// latest posts</p>
      <h2 class="section-title">Recent Articles</h2>
    </div>

    {{ $articlesSection := .Site.GetPage "/articles" }}
    {{ if $articlesSection }}
      {{ $articles := $articlesSection.Pages }}
      {{ $articles = sort $articles "Date" "desc" }}
      <div class="articles-grid">
        {{ range first 6 $articles }}
          {{ $type := .Params.type }}
          {{ if not $type }}{{ $type = "article" }}{{ end }}

          {{ $excerpt := .Params.excerpt }}
          {{ if not $excerpt }}
            {{ $excerpt = .Summary | plainify | truncate 150 }}
          {{ end }}

          {{ $data := dict
              "title"       .Title
              "type"        $type
              "description" $excerpt
              "date"        .Date
              "url"         .RelPermalink
              "image"       .Params.image
              "featured"    .Params.featured
              "context"     "home"
          }}
          {{ partial "post-card.html" $data }}
        {{ end }}
      </div>
    {{ end }}

    <div style="text-align: center; margin-top: 3rem;">
      <a href="/articles/" class="btn btn-outline">View All Articles</a>
    </div>

  </section>
{{ end }}