diff options
author | tdro <tdro@noreply.example.com> | 2022-08-09 18:01:02 -0400 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2022-08-09 18:01:02 -0400 |
commit | b9c195cd39a477c5961eeefb5c428b01562921e0 (patch) | |
tree | 8c5ec21504ccb5d4dbf584a2d9160bb65c014ab3 /themes/default | |
parent | 71871c276878ea40ba03aaa00db09223259916a5 (diff) | |
download | canory-b9c195cd39a477c5961eeefb5c428b01562921e0.tar.gz canory-b9c195cd39a477c5961eeefb5c428b01562921e0.tar.bz2 canory-b9c195cd39a477c5961eeefb5c428b01562921e0.zip |
themes/default/layouts/partials/following-list: Ensure uniqueness
Unique intersect on the domain only.
Diffstat (limited to 'themes/default')
-rw-r--r-- | themes/default/layouts/partials/following-list.html | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/themes/default/layouts/partials/following-list.html b/themes/default/layouts/partials/following-list.html index da8615d..7ef4f34 100644 --- a/themes/default/layouts/partials/following-list.html +++ b/themes/default/layouts/partials/following-list.html @@ -1,11 +1,18 @@ {{- $following := slice -}} +{{- $unique := slice -}} + {{- range (where .Site.Pages "Params.Author" (partial "author-user.html" .)) -}} {{- if .Params.feed -}} {{- $following = $following | append (dict - "Name" .Params.feed.name - "Domain" .Params.feed.domain - "Favicon" .Params.feed.image + "Domain" .Params.feed.domain + ) + -}} + {{- + $unique = $unique | append (dict + "Name" .Params.feed.name + "Domain" .Params.feed.domain + "Favicon" .Params.feed.image ) -}} {{- end -}} @@ -14,29 +21,39 @@ <following-list> <h1>Following</h1> <aside> - {{- range $author := first 3 (shuffle (uniq $following)) -}} + {{ range $author := first 3 (shuffle (uniq $following)) }} + + {{- $name := .Name -}} + {{- $favicon := .Domain -}} + {{- range $unique := uniq $unique -}} + {{- if (eq $unique.Domain $favicon) -}} + {{- $name = $unique.Name -}} + {{- $favicon = $unique.Favicon -}} + {{- end -}} + {{- end -}} + <micro-author> <micro-card> <micro-summary> <micro-thumbnail> <figure> - <a title="{{ .Name }}" href="http://{{ .Domain }}"> + <a title="{{ $name }}" href="http://{{ $name }}"> <picture> <img width="64" height="64" - alt="{{ .Name }}" - src="{{ .Favicon }}" + alt="{{ $name }}" + src="{{ $favicon }}" /> </picture> </a> </figure> </micro-thumbnail> <micro-header> - <h2><b>{{ .Name }}</b></h2> - <h3><a title="{{ .Name }}" href="http://{{ .Domain }}">@{{ .Domain }}</a></h3> + <h2><b>{{ $name }}</b></h2> + <h3><a title="{{ $name }}" href="http://{{ .Domain }}">@{{ .Domain }}</a></h3> </micro-header> - <a title="Follow {{ .Name }}" href="http://{{ .Domain }}"> + <a title="Follow {{ $name }}" href="http://{{ .Domain }}"> {{ safeHTML (readFile (print (partial "function-paths.html" "static") "/icons/feather/rss.svg")) }} <span>Follow</span> </a> |