1
+ {{ $pagelist := $.Scratch.Get "pages" }}
2
+ {{ if $pagelist }}
3
+ < div >
4
+ {{ $pages := where $pagelist "Kind" "page" }}
5
+
6
+ {{ $paginator := .Paginate (where $pages ".Params.exclude" "!=" "true") .Site.Params.paginate }}
7
+ < div class ="flex flex-wrap sm:-m-4 -mx-4 -mb-10 -mt-4 ">
8
+ {{ range $paginator.Pages }}
9
+ < a target ="_blank " rel ="noopener " href ="{{ .Params.Link }} "
10
+ class ="card p-4 md:w-1/3 sm:mb-4 mb-6 hover:shadow-xl hover:bg-gray-400 transition duration-200 ease-in rounded-lg {{ lower .Section }} ">
11
+ < div class ="rounded-lg h-64 overflow-hidden relative ">
12
+ {{ if (or .Params.Image .CurrentSection.Params.Image) }}
13
+ < img alt ="{{ .Title }} " class ="object-cover object-center h-full w-full "
14
+ src ="{{ (or .Params.Image .CurrentSection.Params.Image) }} " />
15
+ {{ end }}
16
+ < span class ="bg-blue-500 text-white px-3 py-1 tracking-widest text-xs absolute right-0 top-0 rounded-bl "> {{
17
+ title .Section }}</ span >
18
+ < h2
19
+ class ="text-white px-2 py-1 tracking-widest text-2xl leading-tight font-extrabold font-bree text-center w-full h-full flex justify-center items-center absolute top-0 left-0 ">
20
+ {{ .Title }}
21
+ </ h2 >
22
+ < p
23
+ class ="text-white px-2 py-1 tracking-widest text-md leading-tight font-light w-full text-center absolute bottom-0 left-0 ">
24
+ {{ .Params.Subtitle }}
25
+ </ p >
26
+ </ div >
27
+ </ a >
28
+ {{ end }}
29
+ </ div >
30
+
31
+
32
+ {{ if gt $paginator.TotalPages 1 }}
33
+ < nav aria-label ="Page navigation ">
34
+ < ul class ="flex gap-2 justify-center mt-2 ">
35
+ {{ if $paginator.HasPrev }}
36
+ < li class ="cursor-pointer rounded hover:bg-blue-400 hover:text-white "> < a class ="px-3 py-1 "
37
+ href ="{{ $paginator.Prev.URL }} " rel ="prev " class ="page-link "> « Prev</ a > </ li >
38
+ {{ end }}
39
+ {{ range $paginator.Pagers }}
40
+ {{ if eq . $paginator }}
41
+ < li class ="cursor-pointer rounded bg-blue-500 text-white "> < a class ="px-3 py-1 " href ="{{ .URL }} "
42
+ class ="page-link "> {{ .PageNumber }}</ a > </ li >
43
+ {{ else }}
44
+ < li class ="cursor-pointer rounded hover:bg-blue-400 hover:text-white "> < a class ="px-3 py-1 " href ="{{ .URL }} "
45
+ class ="page-link "> {{ .PageNumber }}</ a > </ li >
46
+ {{ end }}
47
+ {{ end }}
48
+
49
+ {{ if $paginator.HasNext }}
50
+ < li class ="cursor-pointer rounded hover:bg-blue-400 hover:text-white "> < a class ="px-3 py-1 "
51
+ href ="{{ $paginator.Next.URL }} " rel ="next " class ="page-link "> Next »</ a > </ li >
52
+ {{ end }}
53
+ </ ul >
54
+ </ nav >
55
+ {{ end }}
56
+ </ div >
57
+ {{ end }}
0 commit comments