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 | |
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')
-rw-r--r-- | themes/default/layouts/_default/section.following.html | 120 | ||||
-rw-r--r-- | themes/default/layouts/_default/section.gallery.html | 6 | ||||
-rw-r--r-- | themes/default/layouts/_default/section.webring.html | 94 |
3 files changed, 115 insertions, 105 deletions
diff --git a/themes/default/layouts/_default/section.following.html b/themes/default/layouts/_default/section.following.html index eef5e12..7057e97 100644 --- a/themes/default/layouts/_default/section.following.html +++ b/themes/default/layouts/_default/section.following.html @@ -1,65 +1,69 @@ -{{- $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 -}} + {{- $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) "" -}} + {{- $sources = $sources | append (string $url) -}} + {{- end -}} -{{- range $source := (first 3 (shuffle $sources)) -}} - {{- range $distinct := first 1 (where $feeds "FeedSourceLink" "eq" $source) -}} + {{- range $source := (first 3 (shuffle $sources)) -}} + {{- range $distinct := first 1 (where $feeds "FeedSourceLink" "eq" $source) -}} - {{- $href := or $distinct.FeedHome (print "http://" $distinct.FeedSourceDomain) -}} - {{- $favicon := print "/" (partial "function-paths.html").media "/favicon." (.FeedSourceLink | anchorize) ".png" -}} + {{- $href := or $distinct.FeedHome (print "http://" $distinct.FeedSourceDomain) -}} + {{- $favicon := print "/" (partial "function-paths.html").media "/favicon." (.FeedSourceLink | anchorize) ".png" -}} - <micro-author> - <micro-card> - <micro-summary> - <micro-thumbnail> - <figure> - <a - title="{{ $distinct.FeedName }}" - href="{{ $href }}"> - <picture> - <img - width="64" - height="64" - alt="{{ $distinct.FeedName }}" - src="{{ $.Site.BaseURL }}{{ $favicon }}" - /> - </picture> - </a> - </figure> - </micro-thumbnail> - <micro-header> - <h2> - <b>{{ $distinct.FeedName }}</b> - </h2> - <h3> - <a - data-hover - title="{{ $distinct.FeedName }}" - href="{{ $href }}"> - @{{ $distinct.FeedSourceDomain }} - </a> - </h3> - <time - title="{{ $distinct.FeedDateTitle }}" - datetime="{{ $distinct.FeedDateTime }}"> - {{ $distinct.FeedDateTime | time.Format "15:04 Jan 2 2006" -}} - </time> - </micro-header> - <a - title="Follow {{ $distinct.FeedName }}" - href="{{ $href }}"> - {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/rss.svg")) }} - <header>Follow</header> - </a> - </micro-summary> - </micro-card> - </micro-author> + <micro-author> + <micro-card> + <micro-summary> + <micro-thumbnail> + <figure> + <a + title="{{ $distinct.FeedName }}" + href="{{ $href }}"> + <picture> + <img + width="64" + height="64" + alt="{{ $distinct.FeedName }}" + src="{{ $.Site.BaseURL }}{{ $favicon }}" + /> + </picture> + </a> + </figure> + </micro-thumbnail> + <micro-header> + <h2> + <b>{{ $distinct.FeedName }}</b> + </h2> + <h3> + <a + data-hover + title="{{ $distinct.FeedName }}" + href="{{ $href }}"> + @{{ $distinct.FeedSourceDomain }} + </a> + </h3> + <time + title="{{ $distinct.FeedDateTitle }}" + datetime="{{ $distinct.FeedDateTime }}"> + {{ $distinct.FeedDateTime | time.Format "15:04 Jan 2 2006" -}} + </time> + </micro-header> + <a + title="Follow {{ $distinct.FeedName }}" + href="{{ $href }}"> + {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/rss.svg")) }} + <header>Follow</header> + </a> + </micro-summary> + </micro-card> + </micro-author> + {{- end -}} {{- end -}} {{- end -}} diff --git a/themes/default/layouts/_default/section.gallery.html b/themes/default/layouts/_default/section.gallery.html index dfa141e..4b1c6fd 100644 --- a/themes/default/layouts/_default/section.gallery.html +++ b/themes/default/layouts/_default/section.gallery.html @@ -1 +1,5 @@ -{{- partial "gallery-walk.html" . -}} +{{- $parent := eq (len .Page.Ancestors) 1 -}} + +{{- if $parent -}} + {{- partial "gallery-walk.html" . -}} +{{- end -}} 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 -}} |