Split duplicated .page-list div into separate partial

This commit is contained in:
BBaoVanC 2022-05-06 21:14:42 -05:00
parent a9d1c25ee4
commit 805dc65ccb
Signed by: bbaovanc
GPG Key ID: 18089E4E3CCF1D3A
10 changed files with 28 additions and 115 deletions

View File

@ -14,19 +14,7 @@
</div> </div>
{{ end }} {{ end }}
<div class="page-list"> {{ partial "page-list.html" .Paginator.Pages }}
{{ with .Paginator.Pages }}
<ul>
{{ range . }}
<li>{{ .Render "summary/post" }}</li>
{{ end }}
</ul>
{{ else }}
<div>
{{ i18n "no_posts" }}
</div>
{{ end }}
</div>
</div> </div>
{{ partial "pagination.html" . }} {{ partial "pagination.html" . }}

View File

@ -79,13 +79,7 @@
<div class="related-posts full-width-page-list"> <div class="related-posts full-width-page-list">
<hr> <hr>
<h1>{{ i18n "related_posts" }}</h1> <h1>{{ i18n "related_posts" }}</h1>
<div class="page-list"> {{ partial "page-list.html" . }}
<ul>
{{ range . }}
<li>{{ .Render "summary/post" }}</li>
{{ end }}
</ul>
</div>
</div> </div>
{{ end }} {{ end }}

View File

@ -7,21 +7,11 @@
{{ partial "post-metadata/author.html" . }} {{ partial "post-metadata/author.html" . }}
{{ .Content }} {{ with .Content }}
{{ . }}
{{ end }}
<div class="page-list"> {{ partial "page-list.html" .Paginator.Pages }}
{{ with .Paginator.Pages }}
<ul>
{{ range . }}
<li>{{ .Render "summary/post" }}</li>
{{ end }}
</ul>
{{ else }}
<div>
{{ i18n "no_posts" }}
</div>
{{ end }}
</div>
{{ partial "pagination.html" . }} {{ partial "pagination.html" . }}
{{ end }} {{ end }}

View File

@ -9,19 +9,7 @@
{{ . }} {{ . }}
{{ end }} {{ end }}
<div class="page-list"> {{ partial "page-list.html" .Paginator.Pages }}
{{ with .Paginator.Pages }}
<ul>
{{ range . }}
<li>{{ .Render "summary/post" }}</li>
{{ end }}
</ul>
{{ else }}
<div>
{{ i18n "no_posts" }}
</div>
{{ end }}
</div>
{{ partial "pagination.html" . }} {{ partial "pagination.html" . }}
{{ end }} {{ end }}

View File

@ -13,19 +13,7 @@
{{ partial "rss-link.html" . }} {{ partial "rss-link.html" . }}
</h1> </h1>
{{ with (.Paginate .Site.RegularPages).Pages }} {{ partial "page-list.html" (.Paginate .Site.RegularPages).Pages }}
<div class="page-list">
<ul>
{{ range . }}
<li>{{ .Render "summary/post" }}</li>
{{ end }}
</ul>
</div>
{{ else }}
<div>
{{ i18n "no_posts" }}
</div>
{{ end }}
{{ partial "pagination.html" . }} {{ partial "pagination.html" . }}
</div> </div>

View File

@ -6,16 +6,6 @@
</h1> </h1>
{{ with .Site.RegularPages | first 5 }} {{ with .Site.RegularPages | first 5 }}
<div class="page-list"> {{ partial "page-list.html" . }}
<ul>
{{ range . }}
<li>{{ .Render "summary/post" }}</li>
{{ end }}
</ul>
</div>
{{ else }}
<div>
{{ i18n "no_posts" }}
</div>
{{ end }} {{ end }}
</div> </div>

View File

@ -0,0 +1,13 @@
<div class="page-list">
{{ with . }}
<ul>
{{ range . }}
<li>{{ .Render "summary/post" }}</li>
{{ end }}
</ul>
{{ else }}
<div>
{{ i18n "no_posts" }}
</div>
{{ end }}
</div>

View File

@ -11,24 +11,10 @@
{{ . }} {{ . }}
{{ end }} {{ end }}
<div class="page-list"> {{ with .Paginator.Pages.Reverse }}
{{ with .Paginator.Pages.Reverse }} {{ partial "page-list.html" . }}
<ul> {{ end }}
{{ $i := 0 }}
{{ $total := len $.Pages }}
{{ range . }}
{{ $i = add 1 $i }}
{{ .Scratch.Set "series_position" $i }}
{{ .Scratch.Set "series_total" $total }}
<li>{{ .Render "summary/post" }}</li>
{{ end }}
</ul>
{{ else }}
<div>
{{ i18n "no_posts" }}
</div>
{{ end }}
</div>
{{ partial "pagination.html" . }} {{ partial "pagination.html" . }}
{{ end }} {{ end }}

View File

@ -9,19 +9,7 @@
{{ . }} {{ . }}
{{ end }} {{ end }}
<div class="page-list"> {{ partial "page-list.html" .Paginator.Pages }}
{{ with .Paginator.Pages }}
<ul>
{{ range . }}
<li>{{ .Render "summary/post" }}</li>
{{ end }}
</ul>
{{ else }}
<div>
{{ i18n "no_posts" }}
</div>
{{ end }}
</div>
{{ partial "pagination.html" . }} {{ partial "pagination.html" . }}
{{ end }} {{ end }}

View File

@ -9,19 +9,7 @@
{{ . }} {{ . }}
{{ end }} {{ end }}
<div class="page-list"> {{ partial "page-list.html" .Paginator.Pages }}
{{ with .Paginator.Pages }}
<ul>
{{ range . }}
<li>{{ .Render "summary/post" }}</li>
{{ end }}
</ul>
{{ else }}
<div>
{{ i18n "no_posts" }}
</div>
{{ end }}
</div>
{{ partial "pagination.html" . }} {{ partial "pagination.html" . }}
{{ end }} {{ end }}