diff options
author | tdro <tdro@noreply.example.com> | 2023-06-10 18:16:04 -0400 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2023-06-10 18:16:04 -0400 |
commit | 77f6dfc5b8d98b2d47788988eb4bcf7449f8f782 (patch) | |
tree | 584ff99e325cd0585fd63614b111b41a7b18e425 | |
parent | 067038f579efeae47e6a9560313f0e948996c553 (diff) | |
download | canory-77f6dfc5b8d98b2d47788988eb4bcf7449f8f782.tar.gz canory-77f6dfc5b8d98b2d47788988eb4bcf7449f8f782.tar.bz2 canory-77f6dfc5b8d98b2d47788988eb4bcf7449f8f782.zip |
themes/default/layouts/partials/count: Cleanup counters
-rw-r--r-- | themes/default/layouts/_default/section.drafts.html | 5 | ||||
-rw-r--r-- | themes/default/layouts/_default/section.likes.html | 5 | ||||
-rw-r--r-- | themes/default/layouts/_default/section.media.html | 8 | ||||
-rw-r--r-- | themes/default/layouts/partials/count-drafts.html | 16 | ||||
-rw-r--r-- | themes/default/layouts/partials/count-feeds.html | 18 | ||||
-rw-r--r-- | themes/default/layouts/partials/count-likes.html | 16 | ||||
-rw-r--r-- | themes/default/layouts/partials/count-media.html | 26 |
7 files changed, 47 insertions, 47 deletions
diff --git a/themes/default/layouts/_default/section.drafts.html b/themes/default/layouts/_default/section.drafts.html index b582893..468fd7e 100644 --- a/themes/default/layouts/_default/section.drafts.html +++ b/themes/default/layouts/_default/section.drafts.html @@ -32,10 +32,9 @@ {{- partial "profile.html" . -}} {{- $author := partial "function-authors-data.html" . -}} - {{- $author = $author.user -}} - {{- $users := where .Site.RegularPages "Section" $author -}} + {{- $authors := where .Site.RegularPages "Section" $author.user -}} {{- $drafts := where .Site.RegularPages "Draft" true -}} - {{- $filteredPages := $users | intersect $drafts -}} + {{- $filteredPages := $authors | intersect $drafts -}} {{- $paginator := .Paginate $filteredPages -}} {{- range $paginator.Pages -}} diff --git a/themes/default/layouts/_default/section.likes.html b/themes/default/layouts/_default/section.likes.html index 311cbbb..d85f9a9 100644 --- a/themes/default/layouts/_default/section.likes.html +++ b/themes/default/layouts/_default/section.likes.html @@ -18,10 +18,9 @@ {{- define "middle" -}} {{- $author := partial "function-authors-data.html" . -}} - {{- $author = $author.user -}} - {{- $users := where .Site.RegularPages "Section" $author -}} + {{- $authors := where .Site.RegularPages "Section" $author.user -}} {{- $likes := where .Site.RegularPages ".Params.liked" true -}} - {{- $filteredPages := $users | intersect $likes -}} + {{- $filteredPages := $authors | intersect $likes -}} {{- $paginator := .Paginate $filteredPages -}} {{- partial "navigator-middle.html" diff --git a/themes/default/layouts/_default/section.media.html b/themes/default/layouts/_default/section.media.html index 48cf4a7..5bf7d89 100644 --- a/themes/default/layouts/_default/section.media.html +++ b/themes/default/layouts/_default/section.media.html @@ -32,13 +32,15 @@ {{- partial "profile.html" . -}} {{- $author := partial "function-authors-data.html" . -}} - {{- $author = $author.user -}} {{- $notFeeds := where .Site.RegularPages "Params.feed" "eq" nil -}} - {{- $users := where .Site.RegularPages "Section" $author -}} - {{- $filteredPages := $users | intersect $notFeeds -}} + {{- $authors := where .Site.RegularPages "Section" $author.user -}} + {{- $filteredPages := $authors | intersect $notFeeds -}} {{- $count := 0 -}} {{- range first 100 $filteredPages -}} + {{- if eq $count 10 -}} + {{- break -}} + {{- end -}} {{- if or (in .Content "<figure>") (in .Content "<imgur-video>") diff --git a/themes/default/layouts/partials/count-drafts.html b/themes/default/layouts/partials/count-drafts.html index 3c0cc5a..e2d93e9 100644 --- a/themes/default/layouts/partials/count-drafts.html +++ b/themes/default/layouts/partials/count-drafts.html @@ -1,12 +1,12 @@ {{- $author := partial "function-authors-data.html" . -}} -{{- $author = $author.user -}} +{{- $count := 0 -}} -{{ $count := 0 }} +{{- $authors := where .Site.RegularPages "Section" $author.user -}} +{{- $drafts := where .Site.RegularPages "Draft" true -}} +{{- $filteredPages := $authors | intersect $drafts -}} -{{ range .Site.Pages }} - {{ if and (eq .Type $author) .Draft }} - {{ $count = add $count 1 }} - {{ end }} -{{ end }} +{{- range $filteredPages -}} + {{- $count = add $count 1 -}} +{{- end -}} -{{ print (lang.FormatNumberCustom 0 $count) " " "Drafts" }} +{{- print (lang.FormatNumberCustom 0 $count) " " "Drafts" -}} diff --git a/themes/default/layouts/partials/count-feeds.html b/themes/default/layouts/partials/count-feeds.html index 0b8cacc..5bcac19 100644 --- a/themes/default/layouts/partials/count-feeds.html +++ b/themes/default/layouts/partials/count-feeds.html @@ -1,14 +1,12 @@ {{- $author := partial "function-authors-data.html" . -}} -{{- $author = $author.user -}} +{{- $count := 0 -}} -{{ $count := 0 }} +{{- $feeds := where .Site.Pages "Params.feed" "ne" nil -}} +{{- $authors := where .Site.Pages "Section" $author.user -}} +{{- $filteredPages := $authors | intersect $feeds -}} -{{ range .Site.Pages }} - {{ if .Params.feed }} - {{ if eq .Type $author }} - {{ $count = add $count 1 }} - {{ end }} - {{ end }} -{{ end }} +{{- range $filteredPages -}} + {{- $count = add $count 1 -}} +{{- end -}} -{{ print (lang.FormatNumberCustom 0 $count) " " "Messages" }} +{{- print (lang.FormatNumberCustom 0 $count) " " "Messages" -}} diff --git a/themes/default/layouts/partials/count-likes.html b/themes/default/layouts/partials/count-likes.html index 3b8a9ef..7a241f3 100644 --- a/themes/default/layouts/partials/count-likes.html +++ b/themes/default/layouts/partials/count-likes.html @@ -1,12 +1,12 @@ {{- $author := partial "function-authors-data.html" . -}} -{{- $author = $author.user -}} +{{- $count := 0 -}} -{{ $count := 0 }} +{{- $likes := where .Site.RegularPages ".Params.liked" true -}} +{{- $authors := where .Site.RegularPages "Section" $author.user -}} +{{- $filteredPages := $authors | intersect $likes -}} -{{ range .Site.Pages }} - {{ if and (eq .Type $author) .Params.Liked }} - {{ $count = add $count 1 }} - {{ end }} -{{ end }} +{{- range $filteredPages -}} + {{- $count = add $count 1 -}} +{{- end -}} -{{ print (lang.FormatNumberCustom 0 $count) " " "Messages" }} +{{- print (lang.FormatNumberCustom 0 $count) " " "Messages" -}} diff --git a/themes/default/layouts/partials/count-media.html b/themes/default/layouts/partials/count-media.html index 13782cc..393f206 100644 --- a/themes/default/layouts/partials/count-media.html +++ b/themes/default/layouts/partials/count-media.html @@ -1,19 +1,21 @@ {{- $author := partial "function-authors-data.html" . -}} -{{- $author = $author.user -}} +{{- $notFeeds := where .Site.RegularPages "Params.feed" "eq" nil -}} +{{- $authors := where .Site.RegularPages "Section" $author.user -}} +{{- $filteredPages := $authors | intersect $notFeeds -}} +{{- $count := 0 -}} -{{ $count := 0 }} - -{{ range .Site.Pages }} - {{ if or +{{- range first 100 $filteredPages -}} + {{- if eq $count 10 -}} + {{- break -}} + {{- end -}} + {{- if or (in .Content "<figure>") (in .Content "<imgur-video>") (in .Content "<youtube-video>") (in .Content "<video-container>") - }} - {{ if eq .Type $author }} - {{ $count = add $count 1 }} - {{ end }} - {{ end }} -{{ end }} + -}} + {{- $count = add $count 1 -}} + {{- end -}} +{{- end -}} -{{ print (lang.FormatNumberCustom 0 $count) " " "Messages" }} +{{- print (lang.FormatNumberCustom 0 $count) " " "Messages" -}} |