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 | 067038f579efeae47e6a9560313f0e948996c553 (patch) | |
tree | d52da11d807a320cd4e086cb6d9631a948bd1dea /themes/default/layouts/_default/section.media.html | |
parent | 781001b76fccd6ff859676ffe0340aa9a7ce9201 (diff) | |
download | canory-067038f579efeae47e6a9560313f0e948996c553.tar.gz canory-067038f579efeae47e6a9560313f0e948996c553.tar.bz2 canory-067038f579efeae47e6a9560313f0e948996c553.zip |
themes/default/layouts/_default/section.media: Limit and intersect
Diffstat (limited to 'themes/default/layouts/_default/section.media.html')
-rw-r--r-- | themes/default/layouts/_default/section.media.html | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/themes/default/layouts/_default/section.media.html b/themes/default/layouts/_default/section.media.html index 420035b..48cf4a7 100644 --- a/themes/default/layouts/_default/section.media.html +++ b/themes/default/layouts/_default/section.media.html @@ -33,28 +33,24 @@ {{- $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 -}} + {{- $count := 0 -}} - {{- $count := 0 -}} - {{- $result := false -}} - - {{- range .Site.RegularPages -}} + {{- range first 100 $filteredPages -}} {{- if or (in .Content "<figure>") (in .Content "<imgur-video>") (in .Content "<youtube-video>") (in .Content "<video-container>") -}} - {{- if eq .Type $author -}} - {{- $result = true -}} + {{- partial "render-embed.html" . -}} {{- $count = add $count 1 -}} - {{- if le $count 10 -}} - {{- partial "render-embed.html" . -}} - {{- end -}} - {{- end -}} {{- end -}} {{- end -}} - {{- if not $result -}} + {{- if not $count -}} <footer> <code>No media found!</code> </footer> |