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

row-blog.html « partials « layouts - github.com/mattstratton/castanet.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8c7ea5a605732fde07ed287c387d952c9d4a5c55 (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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<div class="row hero_container">

  <div class="col-md-12">
  <h2>
  Latest Blog Post
  </h2>

  {{ range first 1 ((where .Pages.ByDate "Section" "blog").Reverse) }}
    {{- with .Params.truncate -}}
      {{- $.Scratch.Set "truncate" . }}
    {{- else -}}
      {{- with .Site.Params.truncate -}}
        {{- $.Scratch.Set "truncate" . }}
      {{- else -}}
        {{- $.Scratch.Set "truncate" 600 -}}
      {{- end -}}
    {{- end -}}
    {{- with .Params.blog_banner -}}
      {{- $.Scratch.Set "blog_banner" "true" -}}
    {{- end -}}

    {{- if eq ($.Scratch.Get "blog_banner") "true" -}}
      <div class = "row homepage_episode_row">
        <div class = "col">
          <a href="{{ .Permalink }}" class = "row_latest_episode_title"><h2>{{ .Title }}</h2></a>
          <small>Posted on {{ dateFormat "Monday, Jan 2, 2006" .Date }} {{ partial "blog-metadata.html" . }}</small>
        </div>
      </div>
      <div class = "row homepage_episode_row">
        <div class = "col">
          <a href="{{ .Permalink }}"><img src="{{ .Params.blog_banner | absURL }}" class="img-fluid blog_image"/></a>
        </div>
      </div>
      <div class = "row homepage_episode_row">
        <div class = "col">
          {{ .Description | markdownify | truncate ($.Scratch.Get "truncate") " "}}&nbsp;<small><a href = "{{ .Permalink }}">Read More</a></small>
        </div>
      </div>
    {{- else -}}
    <!-- begin square row -->
    <div class = "row homepage_episode_row">
      <div class = "col-md-12">
        <a href="{{ .Permalink }}" class = "row_latest_episode_title"><h2>{{ .Title }}</h2></a>
        <small>Posted on {{ dateFormat "Monday, Jan 2, 2006" .Date }} {{ partial "blog-metadata.html" .}}</small>
      </div>
    </div>
    {{- if .Params.blog_image -}}
      <div class = "row homepage_episode_row">
        <div class = "col-md-3">
          <a href="{{ .Permalink }}"><img class = "img-fluid" src = "{{ .Params.blog_image | absURL }}" /></a>
        </div>
        <div class = "col-md-8">
          {{- if ge (countrunes .Description ) ($.Scratch.Get "truncate") -}}
            <p class = "hompage_episode_description">{{ .Description | markdownify | truncate ($.Scratch.Get "truncate") " "}}&nbsp;<small><a href = "{{ .Permalink }}">Read More</a></small></p>
          {{- else -}}
            <p class = "hompage_episode_description">{{ .Description | markdownify }}</p>
          {{- end -}}
        </div>
      </div><!-- end square row -->
    {{- else -}}
      <div class = "col">
      {{- if ge (countrunes .Description ) ($.Scratch.Get "truncate") -}}
        <p class = "hompage_episode_description">{{ .Description | markdownify | truncate ($.Scratch.Get "truncate") " "}}&nbsp;<small><a href = "{{ .Permalink }}">Read More</a></small></p>
      {{- else -}}
        <p class = "hompage_episode_description">{{ .Description | markdownify }}</p>
      {{- end -}}
      </div>
    {{- end -}}
  {{- end -}}

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

<section class="episode-list">
<!-- rest of episodes -->
{{- if (where .Pages.ByDate "Section" "blog") -}}
{{- $paginator := .Paginate (after 1 ((where .Pages.ByDate "Section" "blog").Reverse)) }}
{{- $list := (where .Pages.ByDate "Section" "blog") -}}
{{- $len := (len $list) -}}
<div class="row main_container">

  <div class="col-md-8">
{{- if gt $len 1 -}}
    {{- range $paginator.Pages -}}
    {{- with .Params.truncate -}}
      {{- $.Scratch.Set "truncate" . }}
    {{- else -}}
      {{- with .Site.Params.truncate -}}
        {{- $.Scratch.Set "truncate" . }}
      {{- else -}}
        {{- $.Scratch.Set "truncate" 600 -}}
      {{- end -}}
    {{- end -}}
      <div class = "row homepage_episode_row">
        <div class = "col-md-12">
          <a href="{{ .Permalink }}" class= "grid_episode_title"><h3 class= "grid_episode_title">{{ .Title }}</h3></a>
          <small>Posted on {{ dateFormat "Monday, Jan 2, 2006" .Date }} {{ partial "blog-metadata.html" .}}</small>
        </div>
      </div>
      <div class = "row homepage_episode_row">
      {{- if .Params.blog_image -}}
          <div class = "col-md-4">
            <a href="{{ .Permalink }}"><img class = "img-fluid" src = "{{ .Params.blog_image | absURL }}" /></a>
          </div>
          <div class = "col-md-8">
          {{- if ge (countrunes .Description ) ($.Scratch.Get "truncate") -}}
            <p class = "hompage_episode_description">{{ .Description | markdownify | truncate ($.Scratch.Get "truncate") " "}}&nbsp;<small><a href = "{{ .Permalink }}">Read More</a></small></p>
          {{- else -}}
            <p class = "hompage_episode_description">{{ .Description | markdownify }}</p>
          {{- end -}}
          </div>
        {{- else -}}
          <div class = "col">
          {{- if ge (countrunes .Description ) ($.Scratch.Get "truncate") -}}
            <p class = "hompage_episode_description">{{ .Description | markdownify | truncate ($.Scratch.Get "truncate") " "}}&nbsp;<small><a href = "{{ .Permalink }}">Read More</a></small></p>
          {{- else -}}
            <p class = "hompage_episode_description">{{ .Description | markdownify }}</p>
          {{- end -}}
          </div>
        {{- end -}}
      </div>
    {{- end -}}
  {{- end -}}
</div>

</div>
<div class="row">
<div class="col-md-12">
{{- if gt $paginator.TotalPages 1 -}}
<div class = "row">
<div class = "col">


<nav class="pagination justify-content-center">

{{ $pag := $.Paginator }}
{{ $window := $.Site.Params.paginateWindow | default 1 }}
{{ if gt $pag.TotalPages 1 }}
  {{ $total := $pag.TotalPages }}
  {{ $size := add 5 (add $window $window) }}
  {{ $cur := $pag.PageNumber }}
  {{ if gt $total $size }}
    {{ if lt $cur (sub $size (add $window 1)) }}
      {{ $.Scratch.Set "show" (seq 1 (sub $size 2)) }}
    {{ else if lt (sub $total $cur) (sub $size (add $window 2)) }}
      {{ $.Scratch.Set "show" (seq (add (sub $total $size) 3) $total) }}
    {{ else }}
      {{ $.Scratch.Set "show" (seq (sub $cur $window) (add $cur $window)) }}
    {{ end }}
    {{ $.Scratch.Add "show" 1 }}
    {{ $.Scratch.Add "show" $total }}
  {{ else }}
    {{ $.Scratch.Set "show" (seq 1 $total) }}
  {{ end }}

<ul class="pagination pagination-lg">
	<!-- first page button -->
  {{if $paginator.HasPrev }}
    {{ if gt $paginator.PageNumber 2 }}
        {{- with $paginator.First -}}
        {{- $url := trim (string .URL) "/" | absURL -}}
            <li class="page-item">
            <a href="{{ $url }}" aria-label="First" class="page-link"><span aria-hidden="true">&laquo;&laquo;</span></a>
            </li>
        {{- end -}}
    {{ end }}
  {{ end }}


  <!-- prev page button -->
  {{- with $paginator.HasPrev -}}
    	<li class="page-item">
    		<a href="{{ $paginator.Prev.URL }}" class="page-link"> &laquo; </a>
    	</li>
  {{ end }}
  
  <!-- page # buttons -->
  {{ range $pag.Pagers }}
    {{ $cur := .PageNumber }}
    {{- $url := trim (string .URL) "/" | absURL -}}
    {{ if in ($.Scratch.Get "show") $cur }}
      <li class = "{{ if eq . $pag }}active{{ end }} page-item"><a href="{{ .URL }}" class="page-link hidden-md-down">{{ .PageNumber }}</a></li>
    {{ else if in (slice 2 (sub $total 1)) $cur }}
      <li class="disabled page-item"><a name="" class="page-link hidden-md-down">&hellip;</a></li>
    {{ end }}
  {{ end }}
  
  <!-- next page button -->
  {{- with $paginator.HasNext -}}
  <li class="page-item">
    <a href="{{ $paginator.Next.URL }}" class="page-link"> &raquo; </a>
  </li>
  {{ end }}
  
  <!-- last page button -->
  {{ if lt $paginator.PageNumber (sub $paginator.TotalPages 1) }}
    {{- with $paginator.Last -}}
        {{- $url := trim (string .URL) "/" | absURL -}}
            <li class="page-item">
                <a href="{{ $url }}" aria-label="Last" class="page-link"><span aria-hidden="true">&raquo;&raquo;</span></a>
            </li>
    {{- end -}}
  {{ end }}
</ul>
{{ end }}
</nav>
</div>
</div>
{{- end -}}
</div>
{{- end -}}
</div>
</div> <!-- end section -->