mirror of https://github.com/onweru/compose.git

weru
02.31.2025 af3a556a1c07065caeec932635ab92ae7e3a6f85
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
49
50
51
52
53
54
55
56
57
58
59
60
61
{{- define "main" }}
  {{- $blog := site.Params.blogDir }}
  {{- if eq .Section $blog }}
    {{- $pages := where site.RegularPages "Section" $blog }}
    <div class="wrap pt-2 mt-2">
      {{- $paginator := .Paginate $pages -}}
      {{- $size := $paginator.PagerSize }}
      {{- $scratch := newScratch }}
      {{- range $index, $value := $paginator.Pages }}
      {{- if isset .Params "image" }}
      {{- $scratch.Set "image" .Params.image }}
      {{- else }}
      {{- $scratch.Set "image" "thumbnail.svg" }}
      {{- end }}
      {{- $image := $scratch.Get "image" }}
      {{- $bg := $image }}
      {{- if ne (in $image "images") true }}
      {{- $bg = (absURL (printf "images/%s" $image)) }}
      {{- end }}
      {{- if in $image "https://" }}
      {{- $bg = $image }}
      {{- end }}
      <article class="article mb-2">
        <a href="{{ $value.Permalink }}" {{ if eq $index 0 }} class="grid-reverse" {{ end }}>
          <div class="article_thumb" style="background-image: url({{ $bg }});"></div>
          <div class="article_meta {{ if eq $index 0 }} center_y {{ end }}">
            <div class="post_date">{{ dateFormat "January 02, 2006" $value.Date }}</div>
            <h3 class="article_title">{{ $value.Title }}</h3>
            <div class="article_excerpt {{ if eq $index 0 }} visible {{ end }}">
              <p>{{ truncate 100 $value.Plain }}</p>
            </div>
          </div>
        </a>
      </article>
      {{- if and (eq $index 0) (gt $size 1) }}<div class="grid-2 article_showcase">{{ end }}
        {{- if and (eq $index (add $size -1)) (gt $size 1) }}</div>{{ end }}
      {{- end }}
    </div>
    </div>
    <!-- <a href='{{ absURL (printf "post/%s" "") }}' class=post_nav>
      <span class=post_next>View Archive
      <svg class="icon icon_scale">
        <use href="#double-arrow"></use>
      </svg>
      </span>
    </a> -->
  {{- else }}
    {{- .Content }}
    {{ if eq .Kind "taxonomy" }}
    <ol>
      {{ range .Data.Pages }}
        <li>
          <a href="{{ .Permalink }}">
            {{ .Title }}
          </a>
        </li>
      {{ end }}
    </ol>
    {{- end }}
  {{- end }}
{{- end }}