fix #314 - Archive page shows error when there are 0 posts

This commit is contained in:
zzossig 2020-10-29 22:27:37 +09:00
parent e09bbc6d4e
commit 842005439f
11 changed files with 85 additions and 49 deletions

View File

@ -114,3 +114,6 @@ other = "solarized"
[skin-kimbie]
other = "kimbie"
[no-contents]
other = "Nothing to Display"

View File

@ -114,3 +114,6 @@ other = "solarized"
[skin-kimbie]
other = "kimbie"
[no-contents]
other = "Nothing to Display"

View File

@ -114,3 +114,6 @@ other = "solarized"
[skin-kimbie]
other = "kimbie"
[no-contents]
other = "Nothing to Display"

View File

@ -114,3 +114,6 @@ other = "solarized"
[skin-kimbie]
other = "kimbie"
[no-contents]
other = "Nothing to Display"

View File

@ -114,3 +114,6 @@ other = "solarized"
[skin-kimbie]
other = "kimbie"
[no-contents]
other = "Nothing to Display"

View File

@ -114,3 +114,6 @@ other = "solarized"
[skin-kimbie]
other = "kimbie"
[no-contents]
other = "Nothing to Display"

View File

@ -114,3 +114,6 @@ other = "solarized"
[skin-kimbie]
other = "kimbie"
[no-contents]
other = "Nothing to Display"

View File

@ -114,3 +114,6 @@ other = "solarized"
[skin-kimbie]
other = "kimbie"
[no-contents]
other = "Nothing to Display"

View File

@ -114,3 +114,6 @@ other = "solarized"
[skin-kimbie]
other = "kimbie"
[no-contents]
other = "Nothing to Display"

View File

@ -16,8 +16,8 @@
{{ $filteredPages = (where $filteredPages "Type" "!=" (lower .)) }}
{{ end }}
{{ if gt (len $filteredPages) 0 }}
{{ $paginator := .Paginate ($filteredPages.GroupByDate ($.Param "archiveGroupByDate" | default "2006")) ($.Param "archivePaginate") }}
{{ range ($paginator).PageGroups }}
<span class="archive__key" data-ani="{{ $.Site.Params.enableUiAnimation | default "true" }}">{{ .Key }}</span>
<ul class="archive__ul" data-dir="{{ $.Param "languagedir" | default "ltr" }}">
@ -37,6 +37,10 @@
{{ end }}
</ul>
{{ end }}
{{ else }}
{{ i18n "no-contents" | default "There is nothing to display" }}
{{ end }}
</div>
<div class="grow"></div>
{{ partial "pagination/pagination" . }}

View File

@ -17,8 +17,9 @@
{{ end }}
<div class="archive__container">
{{ $pages := (where .Site.RegularPages "Section" "talks") }}
{{ $paginator := .Paginate ($pages.GroupByPublishDate ($.Param "talksGroupByDate" | default "2006")) ($.Param "talksPaginate") }}
{{ if gt (len $pages) 0 }}
{{ $paginator := .Paginate ($pages.GroupByPublishDate ($.Param "talksGroupByDate" | default "2006")) ($.Param "talksPaginate") }}
{{ range ($paginator).PageGroups }}
<span class="archive__key" data-ani="{{ $.Site.Params.enableUiAnimation | default "true" }}">{{ .Key }}</span>
<ul class="archive__ul" data-dir="{{ $.Param "languagedir" | default "ltr" }}">
@ -45,6 +46,10 @@
{{ end }}
</ul>
{{ end }}
{{ else }}
{{ i18n "no-contents" | default "There is nothing to display" }}
{{ end }}
</div>
<div class="grow"></div>
{{ partial "pagination/pagination" . }}