From 773db7d222adcf5c4e47bf06dd071417831bfc60 Mon Sep 17 00:00:00 2001 From: tdro Date: Mon, 26 Dec 2022 17:01:58 -0500 Subject: themes/default/layouts/_default/section.following: Select distinct Bring back up the stack --- themes/default/layouts/_default/rss.xml | 6 +++- .../layouts/_default/section.following.html | 38 ++++++++++------------ .../default/layouts/partials/author-picture.html | 5 ++- .../layouts/partials/function-generate-feeds.html | 3 +- 4 files changed, 28 insertions(+), 24 deletions(-) diff --git a/themes/default/layouts/_default/rss.xml b/themes/default/layouts/_default/rss.xml index 9206978..23497ba 100644 --- a/themes/default/layouts/_default/rss.xml +++ b/themes/default/layouts/_default/rss.xml @@ -91,7 +91,11 @@ {{- $atomAuthorName := or .Params.Feed.name $author.name -}} {{- if .Params.Feed.favicon -}} - {{- $atomAuthorUri = .Params.Feed.favicon | absURL -}} + {{- $favicon := print "/" (partial "function-paths.html" "media") "/favicon." (.Params.Feed.source | anchorize) ".png" -}} + {{- if not (fileExists (print "public/" $favicon)) -}} + {{- $favicon = "/data/media/404.png" -}} + {{- end -}} + {{- $atomAuthorUri = print .Site.BaseURL $favicon -}} {{- end -}} diff --git a/themes/default/layouts/_default/section.following.html b/themes/default/layouts/_default/section.following.html index fc48172..ad3886d 100644 --- a/themes/default/layouts/_default/section.following.html +++ b/themes/default/layouts/_default/section.following.html @@ -1,21 +1,18 @@ -{{- $feeds := slice -}} -{{- $paths := slice -}} +{{- $sources := slice -}} {{- $author := partial "function-authors-data.html" . -}} +{{- $feeds := partial "function-generate-feeds.html" . -}} {{- range $author.feeds.rss -}} {{- $data := split . " " -}} {{- $url := delimit (first 1 $data) "" -}} - {{- $feeds = $feeds | append (string $url) -}} + {{- $sources = $sources | append (string $url) -}} {{- end -}} -{{- range first 3 (shuffle $feeds) -}} - {{- $sources := where $.Site.RegularPages "Params.feed.source" . -}} - {{- $via := where $.Site.RegularPages "Params.Author" $author.user -}} - {{- $following := $via | intersect $sources -}} +{{- range $source := (first 3 (shuffle $sources)) -}} + {{- range $distinct := first 1 (where $feeds "FeedSourceLink" "eq" $source) -}} - {{- range first 1 $following -}} - - {{- $href := or .Params.feed.home (print "http://" .Params.feed.domain) -}} + {{- $href := or $distinct.FeedHome (print "http://" $distinct.FeedSourceDomain) -}} + {{- $favicon := print "/" (partial "function-paths.html" "media") "/favicon." (.FeedSourceLink | anchorize) ".png" -}} @@ -23,14 +20,14 @@
{{ .Params.feed.name }} @@ -38,23 +35,23 @@

- {{ .Params.feed.name }} + {{ $distinct.FeedName }}

- @{{ .Params.feed.domain }} + @{{ $distinct.FeedSourceDomain }}

{{ safeHTML (readFile (print (partial "function-paths.html" "static") "/icons/feather/rss.svg")) }} Follow @@ -62,5 +59,6 @@ + {{- end -}} {{- end -}} diff --git a/themes/default/layouts/partials/author-picture.html b/themes/default/layouts/partials/author-picture.html index 05d5cf1..becb40a 100644 --- a/themes/default/layouts/partials/author-picture.html +++ b/themes/default/layouts/partials/author-picture.html @@ -11,7 +11,10 @@ {{- $alternate = $.Params.feed.name -}} {{- $width = "64" -}} {{- $height = "64" -}} - {{- $source = $.Params.feed.favicon -}} + {{- $source = print "/" (partial "function-paths.html" "media") "/favicon." ($.Params.feed.source | anchorize) ".png" -}} + {{- if not (fileExists (print "public/" $source)) -}} + {{- $source = $.Params.feed.favicon -}} + {{- end -}} {{- $sourceset = "" -}} {{- else -}} {{- $source = print "/" (partial "function-paths.html" "media") "/" $author.user "/" $author.user "-profile" (path.Ext $author.picture.profile) -}} diff --git a/themes/default/layouts/partials/function-generate-feeds.html b/themes/default/layouts/partials/function-generate-feeds.html index 4427f44..0bbaf46 100644 --- a/themes/default/layouts/partials/function-generate-feeds.html +++ b/themes/default/layouts/partials/function-generate-feeds.html @@ -193,13 +193,12 @@ {{- with .FeedImageLink -}} {{- $favicon = . -}} - {{- $domain = $name | humanize | urlize -}} {{- end -}} {{- $imageSource := partial "function-fetch-favicons.html" (dict "Source" $favicon - "Infix" $domain + "Infix" (.FeedSourceLink | anchorize) ) -}} -- cgit v1.2.3