Welcome to mirror list, hosted at ThFree Co, Russian Federation.

home.html « _default « layouts « src - github.com/twbs/blog.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 39cc6778992907b049a0ba68c6ddf36de67a128e (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
{{ define "main" }}
<div class="posts-container mx-auto my-5">
  <div class="posts">
    {{ $paginator := .Paginate (where site.RegularPages "Type" "posts") }}
    {{- range $i, $page := $paginator.Pages -}}
      {{- /* Don't lazyload the first video in each page */ -}}
      {{- $lazyload := cond (eq $i 0) false true -}}

      <div class="post">
        <h1 class="post-title fw-600">
          <a href="{{ .RelPermalink }}" class="text-decoration-none">
            {{ .Title }}
          </a>
        </h1>

        {{ partial "author-info" (dict "context" . "lazyload" $lazyload) -}}

        {{ if .Page.Params.video -}}
          {{- partial "video" (dict "context" . "lazyload" $lazyload) -}}
        {{- end }}

        {{ .Content }}
      </div>
    {{- end }}
  </div>

  <div class="pagination">
    {{- if $paginator.HasNext -}}
      <a class="pagination-item older" href="{{ $paginator.Next.URL }}">Older</a>
    {{- else -}}
      <span class="pagination-item older">Older</span>
    {{- end }}
    {{ if $paginator.HasPrev -}}
      <a class="pagination-item newer" href="{{ $paginator.Prev.URL }}">Newer</a>
    {{- else -}}
      <span class="pagination-item newer">Newer</span>
    {{- end }}
  </div>
</div>
{{- end }}