aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2022-12-26 17:01:47 -0500
committertdro <tdro@noreply.example.com>2022-12-26 17:01:47 -0500
commit6bed014c0f3b70bbf8739ea2a48520dd154fa091 (patch)
tree5af9f131e77483f7d0db69db929ef457338b593b
parent75327dddfefbb3259d6cbc6e7b02f481777f4e5b (diff)
downloadcanory-6bed014c0f3b70bbf8739ea2a48520dd154fa091.tar.gz
canory-6bed014c0f3b70bbf8739ea2a48520dd154fa091.tar.bz2
canory-6bed014c0f3b70bbf8739ea2a48520dd154fa091.zip
themes/default/layouts/_default/section.webring: Get distinct
-rw-r--r--themes/default/layouts/_default/section.webring.html28
1 files changed, 25 insertions, 3 deletions
diff --git a/themes/default/layouts/_default/section.webring.html b/themes/default/layouts/_default/section.webring.html
index 8a90f96..d82efe0 100644
--- a/themes/default/layouts/_default/section.webring.html
+++ b/themes/default/layouts/_default/section.webring.html
@@ -1,13 +1,34 @@
+{{- $items := slice -}}
+{{- $sources := slice -}}
{{- $author := partial "function-authors-data.html" . -}}
{{- $feeds := partial "function-generate-feeds.html" . -}}
-{{ range first 3 (uniq (sort $feeds "FeedDateTime" "desc")) }}
+{{- range $author.feeds.rss -}}
+ {{- $data := split . " " -}}
+ {{- $url := delimit (first 1 $data) "" -}}
+ {{- $sources = $sources | append (string $url) -}}
+{{- end -}}
+
+{{- $inner := 1 -}}
+
+{{- if eq (len $sources) 1 -}}
+ {{- $inner = 3 -}}
+{{- end -}}
+
+{{- range $source := (first 3 $sources) -}}
+ {{- range $distinct := first $inner (where $feeds "FeedSourceLink" "eq" $source) -}}
+ {{- $items = $items | append $distinct -}}
+ {{- end -}}
+{{- end -}}
+
+{{- range (sort $items "FeedDateTime" "desc") -}}
+
<web-ring-item>
<header>
<a
title="{{ .FeedLink }}"
href="{{ .FeedLink }}">
- {{ .FeedTitle }}
+ {{ or .FeedTitle (truncate 50 "..." (or .FeedContentShort .FeedDescriptionShort)) }}
</a>
</header>
<time
@@ -30,4 +51,5 @@
{{ .FeedSourceTitle }}
</a>
</web-ring-item>
-{{ end }}
+
+{{- end -}}