aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2022-12-26 17:01:58 -0500
committertdro <tdro@noreply.example.com>2022-12-27 21:05:14 -0500
commit773db7d222adcf5c4e47bf06dd071417831bfc60 (patch)
tree4d213223e0c0ede3b3b787daa04cf26e27eb7f04
parentd27b1096ac6f3f9d5880ecbd97097bfceecefa13 (diff)
downloadcanory-773db7d222adcf5c4e47bf06dd071417831bfc60.tar.gz
canory-773db7d222adcf5c4e47bf06dd071417831bfc60.tar.bz2
canory-773db7d222adcf5c4e47bf06dd071417831bfc60.zip
themes/default/layouts/_default/section.following: Select distinct
Bring back up the stack
-rw-r--r--themes/default/layouts/_default/rss.xml6
-rw-r--r--themes/default/layouts/_default/section.following.html38
-rw-r--r--themes/default/layouts/partials/author-picture.html5
-rw-r--r--themes/default/layouts/partials/function-generate-feeds.html3
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 -}}
<item>
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" -}}
<micro-author>
<micro-card>
@@ -23,14 +20,14 @@
<micro-thumbnail>
<figure>
<a
- title="{{ .Params.feed.name }}"
+ title="{{ $distinct.FeedName }}"
href="{{ $href }}">
<picture>
<img
width="64"
height="64"
- alt="{{ .Params.feed.name }}"
- src="{{ .Params.feed.favicon }}"
+ alt="{{ $distinct.FeedName }}"
+ src="{{ $.Site.BaseURL }}{{ $favicon }}"
/>
</picture>
</a>
@@ -38,23 +35,23 @@
</micro-thumbnail>
<micro-header>
<h2>
- <b>{{ .Params.feed.name }}</b>
+ <b>{{ $distinct.FeedName }}</b>
</h2>
<h3>
<a
- title="{{ .Params.feed.name }}"
+ title="{{ $distinct.FeedName }}"
href="{{ $href }}">
- @{{ .Params.feed.domain }}
+ @{{ $distinct.FeedSourceDomain }}
</a>
</h3>
<time
- title="{{ .Date | time.Format "Monday, January 2, 2006 at 15:04:05 MST" }}"
- datetime="{{ .Date | time.Format "2006-01-02T15:04:05Z" }}">
- {{ (.Date.Local | time.Format "3:04 PM Jan 2 2006") -}}
+ title="{{ $distinct.FeedDateTitle }}"
+ datetime="{{ $distinct.FeedDateTime }}">
+ {{ $distinct.FeedDateTime | time.Format "3:04 PM Jan 2 2006" -}}
</time>
</micro-header>
<a
- title="Follow {{ .Params.feed.name }}"
+ title="Follow {{ $distinct.FeedName }}"
href="{{ $href }}">
{{ safeHTML (readFile (print (partial "function-paths.html" "static") "/icons/feather/rss.svg")) }}
<span>Follow</span>
@@ -62,5 +59,6 @@
</micro-summary>
</micro-card>
</micro-author>
+
{{- 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)
)
-}}