aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2023-12-30 16:39:52 -0500
committertdro <tdro@noreply.example.com>2023-12-30 16:39:52 -0500
commit539775f2cb048827b1a93896f0d848c1bbd6edc1 (patch)
tree88750e2ca96b44f88e6fb5f936d35c0d217b6ce7 /themes/default/layouts
parent4bd7e2fa02f13b4db505c4b13cf824cc1174201b (diff)
downloadcanory-539775f2cb048827b1a93896f0d848c1bbd6edc1.tar.gz
canory-539775f2cb048827b1a93896f0d848c1bbd6edc1.tar.bz2
canory-539775f2cb048827b1a93896f0d848c1bbd6edc1.zip
themes/default/layouts/partials/count: Avoid range in counters
Diffstat (limited to 'themes/default/layouts')
-rw-r--r--themes/default/layouts/partials/count-drafts.html11
-rw-r--r--themes/default/layouts/partials/count-feeds.html11
-rw-r--r--themes/default/layouts/partials/count-marks.html7
-rw-r--r--themes/default/layouts/partials/count-media.html4
-rw-r--r--themes/default/layouts/partials/count.html3
5 files changed, 10 insertions, 26 deletions
diff --git a/themes/default/layouts/partials/count-drafts.html b/themes/default/layouts/partials/count-drafts.html
index 95f04ed..fae0b90 100644
--- a/themes/default/layouts/partials/count-drafts.html
+++ b/themes/default/layouts/partials/count-drafts.html
@@ -1,12 +1,7 @@
-{{- $author := partial "function-authors-data.html" . -}}
-{{- $count := 0 -}}
+{{- $author := .Section -}}
-{{- $authors := where .Site.RegularPages "Section" $author.user -}}
+{{- $authors := where .Site.RegularPages "Section" $author -}}
{{- $drafts := where .Site.RegularPages "Draft" true -}}
{{- $filteredPages := $authors | intersect $drafts -}}
-{{- range $filteredPages -}}
- {{- $count = add $count 1 -}}
-{{- end -}}
-
-{{- print (lang.FormatNumberCustom 0 $count) -}}
+{{- print (lang.FormatNumberCustom 0 (len $filteredPages)) -}}
diff --git a/themes/default/layouts/partials/count-feeds.html b/themes/default/layouts/partials/count-feeds.html
index b3053e2..68495da 100644
--- a/themes/default/layouts/partials/count-feeds.html
+++ b/themes/default/layouts/partials/count-feeds.html
@@ -1,12 +1,7 @@
-{{- $author := partial "function-authors-data.html" . -}}
-{{- $count := 0 -}}
+{{- $author := .Section -}}
{{- $feeds := where .Site.Pages "Params.feed" "ne" nil -}}
-{{- $authors := where .Site.Pages "Section" $author.user -}}
+{{- $authors := where .Site.Pages "Section" $author -}}
{{- $filteredPages := $authors | intersect $feeds -}}
-{{- range $filteredPages -}}
- {{- $count = add $count 1 -}}
-{{- end -}}
-
-{{- print (lang.FormatNumberCustom 0 $count) -}}
+{{- print (lang.FormatNumberCustom 0 (len $filteredPages)) -}}
diff --git a/themes/default/layouts/partials/count-marks.html b/themes/default/layouts/partials/count-marks.html
index b251555..deb532d 100644
--- a/themes/default/layouts/partials/count-marks.html
+++ b/themes/default/layouts/partials/count-marks.html
@@ -1,11 +1,6 @@
-{{- $count := 0 -}}
{{- $author := .Section -}}
{{- $items := where .Site.RegularPages ".Params.marked" true -}}
{{- $authors := where .Site.RegularPages "Section" $author -}}
{{- $filteredPages := $authors | intersect $items -}}
-{{- range $filteredPages -}}
- {{- $count = add $count 1 -}}
-{{- end -}}
-
-{{- print (lang.FormatNumberCustom 0 $count) -}}
+{{- print (lang.FormatNumberCustom 0 (len $filteredPages)) -}}
diff --git a/themes/default/layouts/partials/count-media.html b/themes/default/layouts/partials/count-media.html
index 8a409e7..1d68e0a 100644
--- a/themes/default/layouts/partials/count-media.html
+++ b/themes/default/layouts/partials/count-media.html
@@ -1,6 +1,6 @@
-{{- $author := partial "function-authors-data.html" . -}}
+{{- $author := .Section -}}
{{- $notFeeds := where .Site.RegularPages "Params.feed" "eq" nil -}}
-{{- $authors := where .Site.RegularPages "Section" $author.user -}}
+{{- $authors := where .Site.RegularPages "Section" $author -}}
{{- $filteredPages := $authors | intersect $notFeeds -}}
{{- $count := 0 -}}
diff --git a/themes/default/layouts/partials/count.html b/themes/default/layouts/partials/count.html
index b561439..72b5d03 100644
--- a/themes/default/layouts/partials/count.html
+++ b/themes/default/layouts/partials/count.html
@@ -1,2 +1 @@
-{{- $count := len .Site.RegularPages -}}
-{{- print (lang.FormatNumberCustom 0 $count) -}}
+{{- print (lang.FormatNumberCustom 0 (len .Site.RegularPages)) -}}