blob: 67a8e43ccf699e31755eeea58fdf2a8d66ef9489 (
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
{{ define "main" -}}
<div class="w3-content w3-card-4" >
{{if not .IsHome }}
<h1 class="w3-center">{{ .Title | markdownify }}</h1>
{{ end }}
{{ $paginator := .Paginate (where .Data.Pages "Section" "!=" "") }}
{{ if .Site.Params.gridstyle }}
<!-- grid list style -->
{{ range $i, $e:= $paginator.Pages }}
{{ if modBool $i 3 }}
<div class="w3-row w3-section">
{{ end }}
{{ if .Site.Params.lazyload | and (gt $i 1) }}
{{ $.Scratch.Set "novisual" 1 }}
{{ end }}
<div class="w3-col w3-container w3-section m12 l4 ">
<div class="w3-card-2 w3-hover-shadow " >
{{ with .Params.thumbnail }}
<div class="w3-hover-opacity thumb">
{{ if eq ( $.Scratch.Get "novisual") 1 }}
<img src="{{ "/placeholder.svg" | relURL }}" data-src="{{ relURL . }}" alt="Thumbnail" />
{{ else }}
<img src="{{ relURL . }}" alt="Thumbnail" />
{{ end }}
</div>
{{ else }}
{{ if .Site.Params.firstpic}}
{{ $img := findRE "<img .*?src=\"(.*?)\".*?>" .Content 1 }}
{{ range $img }}
<div class="w3-hover-opacity thumb ">
{{ if eq ( $.Scratch.Get "novisual") 1 }}
<img src="{{ "/placeholder.svg" | relURL }}" data-src="{{ replaceRE "<img .*?src=\"(.*?)\".*?>" "$1" . }}" alt="Thumbnail"/></div>
{{ else }}
<img src="{{ replaceRE "<img .*?src=\"(.*?)\".*?>" "$1" . }}" alt="Thumbnail" /></div>
{{ end }}
{{ end }}
{{ end }}
{{ end }}
<header class="w3-container wraptext w3-text-indigo">
<h4><a href="{{ .URL }}">{{ .Title | markdownify }}</a></h4>
</header>
<div class="w3-container wraptext w3-white">
<code> {{ .Date.Format "2006/01/02" }} </code>
{{ if gt (len .Summary) 200 }}
<p>{{substr .Summary 0 200 }}...</p>
{{ end }}
</div>
<footer >
<a href="{{ .URL }}"><button class="w3-button w3-blue w3-block w3-hover-green">{{ T "readMore" }}</button></a>
</footer>
</div>
</div>
{{ if or (modBool (add $i 1) 3) (ge (add $i 1) $paginator.Pages) }}
</div>
{{ end }}
{{ end }}
{{ else }}
<!-- simple list style -->
<ul class="w3-ul w3-hoverable">
{{ range $paginator.Pages }}
<li>
<span class="date">{{ .Date.Format "2006/01/02" }}</span>
<a href="{{ .URL }}">{{ .Title | markdownify }}</a>
</li>
{{ end }}
{{ end }}
</ul>
</div>
<br>
<div class="w3-content" >
<div class="w3-bar w3-section w3-hide-large w3-hide-medium">
{{ with $paginator.Prev -}}
<a href="{{ .URL }}" class="w3-btn w3-text-indigo w3-hover-green">❮ Previous</a>
{{- end }}
{{ with $paginator.Next -}}
<a href="{{ .URL }}" class="w3-btn w3-right w3-text-indigo w3-hover-green">Next ❯</a>
{{- end }}
</div>
<nav class="w3-center w3-hide-small">{{ template "_internal/pagination.html" . }}</nav>
</div>
{{- end }}
|