diff options
author | tdro <tdro@noreply.example.com> | 2023-06-18 18:32:33 -0400 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2023-06-18 18:32:33 -0400 |
commit | 69591d98d61888c211b986bf96a36014590b4cbf (patch) | |
tree | d5e2dc71a73ea77786080ab5fb2a3878cab65b37 /themes/default/layouts/_default/section.webring.html | |
parent | 23b45c260c734539c684df8b713c32dbea375532 (diff) | |
download | canory-69591d98d61888c211b986bf96a36014590b4cbf.tar.gz canory-69591d98d61888c211b986bf96a36014590b4cbf.tar.bz2 canory-69591d98d61888c211b986bf96a36014590b4cbf.zip |
themes/default/layouts/_default/section: Write gallery, webring, following once
Check for parent node
Diffstat (limited to 'themes/default/layouts/_default/section.webring.html')
-rw-r--r-- | themes/default/layouts/_default/section.webring.html | 94 |
1 files changed, 48 insertions, 46 deletions
diff --git a/themes/default/layouts/_default/section.webring.html b/themes/default/layouts/_default/section.webring.html index 59b26ba..878ad95 100644 --- a/themes/default/layouts/_default/section.webring.html +++ b/themes/default/layouts/_default/section.webring.html @@ -1,57 +1,59 @@ -{{- $items := slice -}} -{{- $sources := slice -}} -{{- $author := partial "function-authors-data.html" . -}} -{{- $feeds := partial "function-generate-feeds.html" . -}} +{{- $parent := eq (len .Page.Ancestors) 1 -}} -{{- range $author.feeds.rss -}} - {{- $data := split . " " -}} - {{- $url := delimit (first 1 $data) "" -}} - {{- $sources = $sources | append (string $url) -}} -{{- end -}} +{{- if $parent -}} + {{- $items := slice -}} + {{- $sources := slice -}} + {{- $author := partial "function-authors-data.html" . -}} + {{- $feeds := partial "function-generate-feeds.html" . -}} -{{- $inner := 1 -}} + {{- range $author.feeds.rss -}} + {{- $data := split . " " -}} + {{- $url := delimit (first 1 $data) "" -}} + {{- $sources = $sources | append (string $url) -}} + {{- end -}} -{{- if eq (len $sources) 1 -}} - {{- $inner = 3 -}} -{{- end -}} + {{- $inner := 1 -}} -{{- range $source := (first 3 $sources) -}} - {{- range $distinct := first $inner (where $feeds "FeedSourceLink" "eq" $source) -}} - {{- $items = $items | append $distinct -}} + {{- if eq (len $sources) 1 -}} + {{- $inner = 3 -}} {{- end -}} -{{- end -}} -{{- range (sort $items "FeedDateTime" "desc") -}} + {{- range $source := (first 3 $sources) -}} + {{- range $distinct := first $inner (where $feeds "FeedSourceLink" "eq" $source) -}} + {{- $items = $items | append $distinct -}} + {{- end -}} + {{- end -}} - <web-ring-item> - <header> + {{- range (sort $items "FeedDateTime" "desc") -}} + <web-ring-item> + <header> + <a + data-hover + title="{{ .FeedLink }}" + href="{{ .FeedLink }}"> + {{ or .FeedTitle (truncate 50 "..." (or .FeedContentShort .FeedDescriptionShort)) }} + </a> + </header> + <time + title="{{ .FeedDateTitle }}" + datetime="{{ .FeedDateTime }}"> + {{ .FeedDate }} + </time> + <p> + {{ "--" | markdownify }} + {{ if gt (len .FeedDescriptionShort) (len .FeedContentShort) -}} + {{ or .FeedDescriptionShort .FeedTitle }} + {{- else -}} + {{ or .FeedContentShort .FeedTitle }} + {{- end }} + — + </p> <a data-hover - title="{{ .FeedLink }}" - href="{{ .FeedLink }}"> - {{ or .FeedTitle (truncate 50 "..." (or .FeedContentShort .FeedDescriptionShort)) }} + title="{{ .FeedSourceDescription }}" + href="{{ or .FeedSourceHome .FeedSourceLink }}"> + {{ .FeedSourceTitle }} </a> - </header> - <time - title="{{ .FeedDateTitle }}" - datetime="{{ .FeedDateTime }}"> - {{ .FeedDate }} - </time> - <p> - {{ "--" | markdownify }} - {{ if gt (len .FeedDescriptionShort) (len .FeedContentShort) -}} - {{ or .FeedDescriptionShort .FeedTitle }} - {{- else -}} - {{ or .FeedContentShort .FeedTitle }} - {{- end }} - — - </p> - <a - data-hover - title="{{ .FeedSourceDescription }}" - href="{{ or .FeedSourceHome .FeedSourceLink }}"> - {{ .FeedSourceTitle }} - </a> - </web-ring-item> - + </web-ring-item> + {{- end -}} {{- end -}} |