diff options
author | Dillon <dillonzq@outlook.com> | 2020-05-12 16:51:38 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-12 16:51:38 +0300 |
commit | 7d0603ece0d0e16c24063e9b30fc753ff8ac389d (patch) | |
tree | 23aab861a1437696eb8b262e494154a34ddab0f3 /layouts/_default/section.html | |
parent | 13b051b5859157f61dd60f694f12fbe48ddbefb9 (diff) |
fix(paginate): paginate error for empty content (#350)
Diffstat (limited to 'layouts/_default/section.html')
-rw-r--r-- | layouts/_default/section.html | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/layouts/_default/section.html b/layouts/_default/section.html index e81c187..9d07c92 100644 --- a/layouts/_default/section.html +++ b/layouts/_default/section.html @@ -10,25 +10,27 @@ </h2> {{- /* Paginate */ -}} - {{- $pages := .Pages.GroupByDate "2006" -}} - {{- with .Site.Params.section.paginate | default .Site.Params.paginate -}} - {{- $pages = $.Paginate $pages . -}} - {{- else -}} - {{- $pages = .Paginate $pages -}} - {{- end -}} - {{- range $pages.PageGroups -}} - <h3 class="group-title">{{ .Key }}</h3> - {{- range .Pages -}} - <article class="archive-item"> - <a href="{{ .RelPermalink }}" class="archive-item-link"> - {{- .Title -}} - </a> - <span class="archive-item-date"> - {{- .Date.Format ($.Site.Params.section.dateFormat | default "01-02") -}} - </span> - </article> + {{- if .Pages -}} + {{- $pages := .Pages.GroupByDate "2006" -}} + {{- with .Site.Params.section.paginate | default .Site.Params.paginate -}} + {{- $pages = $.Paginate $pages . -}} + {{- else -}} + {{- $pages = .Paginate $pages -}} + {{- end -}} + {{- range $pages.PageGroups -}} + <h3 class="group-title">{{ .Key }}</h3> + {{- range .Pages -}} + <article class="archive-item"> + <a href="{{ .RelPermalink }}" class="archive-item-link"> + {{- .Title -}} + </a> + <span class="archive-item-date"> + {{- .Date.Format ($.Site.Params.section.dateFormat | default "01-02") -}} + </span> + </article> + {{- end -}} {{- end -}} + {{- partial "paginator.html" . -}} {{- end -}} - {{- partial "paginator.html" . -}} </div> {{- end -}} |