From 5578c0bd0046bee8bcf7afff8a36bbece5091c26 Mon Sep 17 00:00:00 2001 From: firmart Date: Fri, 11 Sep 2020 18:28:08 +0200 Subject: [PATCH] Show archive only if there is at least one page --- layouts/archive/list.html | 76 ++++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 36 deletions(-) diff --git a/layouts/archive/list.html b/layouts/archive/list.html index 4925349..985f6e4 100644 --- a/layouts/archive/list.html +++ b/layouts/archive/list.html @@ -9,40 +9,44 @@ {{ .Content }} -
-
- {{ $filteredPages := .Site.RegularPages }} - {{ range $.Param "notAllowedTypesInArchive" }} - {{ $filteredPages = (where $filteredPages "Type" "!=" (lower .)) }} - {{ end }} - - {{ $paginator := .Paginate ($filteredPages.GroupByDate ($.Param "archiveGroupByDate" | default "2006")) ($.Param "archivePaginate") }} - - {{ range ($paginator).PageGroups }} - {{ .Key }} -
    - {{ range .Pages }} -
  • - - {{ if ne ($.Param "languagedir") "rtl" }} - {{ .Type }} - {{ .Date.Format (i18n "archive-dateformat") }} - {{ else }} - {{ .Date.Format (i18n "archive-dateformat") }} - {{ .Type }} - {{ end }} - - {{ .Title }} -
  • +{{ if .Pages }} +
    +
    + {{ $filteredPages := .Site.RegularPages }} + {{ range $.Param "notAllowedTypesInArchive" }} + {{ $filteredPages = (where $filteredPages "Type" "!=" (lower .)) }} {{ end }} -
- {{ end }} -
-
- {{ partial "pagination/pagination" . }} -
- {{ partial "search/site-search" . }} -
- {{ partial "script/archive-script" . }} -
-{{ end }} \ No newline at end of file + + {{ $paginator := .Paginate ($filteredPages.GroupByDate ($.Param "archiveGroupByDate" | default "2006")) ($.Param "archivePaginate") }} + + {{ if $paginator }} + {{ range ($paginator).PageGroups }} + {{ .Key }} + + {{ end }} + {{ end }} + +
+ {{ partial "pagination/pagination" . }} +
+ {{ partial "search/site-search" . }} +
+ {{ partial "script/archive-script" . }} + +{{ end }} +{{ end }}