diff options
author | tdro <tdro@noreply.example.com> | 2022-12-21 00:20:05 -0500 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2022-12-21 00:20:05 -0500 |
commit | 7f5c73bc0384f1a0ffec2701d4183e2208007b40 (patch) | |
tree | 16f170cea156fa4e2d904c2f5fdb704843d618d1 /themes/default/layouts/_default | |
parent | 2fb41a96097f335b3e5dbeb8dd0a2ad67bde2d3f (diff) | |
download | canory-7f5c73bc0384f1a0ffec2701d4183e2208007b40.tar.gz canory-7f5c73bc0384f1a0ffec2701d4183e2208007b40.tar.bz2 canory-7f5c73bc0384f1a0ffec2701d4183e2208007b40.zip |
themes/default/layouts/partials: Prevent feed fetches from multiplying0.11.9
By limiting to section. Add hugo option to version shortcode
Diffstat (limited to 'themes/default/layouts/_default')
4 files changed, 109 insertions, 2 deletions
diff --git a/themes/default/layouts/_default/list.html b/themes/default/layouts/_default/list.html index 8f3c5f5..3fc93ce 100644 --- a/themes/default/layouts/_default/list.html +++ b/themes/default/layouts/_default/list.html @@ -26,12 +26,12 @@ {{- partial "author-list.html" . -}} {{ range first 1 (where .Site.Pages "Params.Author" .Site.Author.default.picturegallery) }} - {{- partial "gallery-images.html" . -}} + {{- partial "gallery.html" . -}} {{ end }} {{ range first 1 (where .Site.Pages "Params.Author" .Site.Author.default.webring) }} {{- partial "following-list.html" . -}} - {{- partial "web-ring.html" . -}} + {{- partial "webring.html" . -}} {{ end }} {{ end }} diff --git a/themes/default/layouts/_default/section.following.html b/themes/default/layouts/_default/section.following.html new file mode 100644 index 0000000..fc48172 --- /dev/null +++ b/themes/default/layouts/_default/section.following.html @@ -0,0 +1,66 @@ +{{- $feeds := slice -}} +{{- $paths := slice -}} +{{- $author := partial "function-authors-data.html" . -}} + +{{- range $author.feeds.rss -}} + {{- $data := split . " " -}} + {{- $url := delimit (first 1 $data) "" -}} + {{- $feeds = $feeds | 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 first 1 $following -}} + + {{- $href := or .Params.feed.home (print "http://" .Params.feed.domain) -}} + + <micro-author> + <micro-card> + <micro-summary> + <micro-thumbnail> + <figure> + <a + title="{{ .Params.feed.name }}" + href="{{ $href }}"> + <picture> + <img + width="64" + height="64" + alt="{{ .Params.feed.name }}" + src="{{ .Params.feed.favicon }}" + /> + </picture> + </a> + </figure> + </micro-thumbnail> + <micro-header> + <h2> + <b>{{ .Params.feed.name }}</b> + </h2> + <h3> + <a + title="{{ .Params.feed.name }}" + href="{{ $href }}"> + @{{ .Params.feed.domain }} + </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") -}} + </time> + </micro-header> + <a + title="Follow {{ .Params.feed.name }}" + href="{{ $href }}"> + {{ safeHTML (readFile (print (partial "function-paths.html" "static") "/icons/feather/rss.svg")) }} + <span>Follow</span> + </a> + </micro-summary> + </micro-card> + </micro-author> + {{- end -}} +{{- end -}} diff --git a/themes/default/layouts/_default/section.gallery.html b/themes/default/layouts/_default/section.gallery.html new file mode 100644 index 0000000..276ae9c --- /dev/null +++ b/themes/default/layouts/_default/section.gallery.html @@ -0,0 +1,8 @@ +{{- $folder := print "public/" .Section "/media/" -}} + +{{- partial "gallery-walk.html" + (dict + "Folder" $folder + "Context" . + ) +-}} diff --git a/themes/default/layouts/_default/section.webring.html b/themes/default/layouts/_default/section.webring.html new file mode 100644 index 0000000..8a90f96 --- /dev/null +++ b/themes/default/layouts/_default/section.webring.html @@ -0,0 +1,33 @@ +{{- $author := partial "function-authors-data.html" . -}} +{{- $feeds := partial "function-generate-feeds.html" . -}} + +{{ range first 3 (uniq (sort $feeds "FeedDateTime" "desc")) }} + <web-ring-item> + <header> + <a + title="{{ .FeedLink }}" + href="{{ .FeedLink }}"> + {{ .FeedTitle }} + </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 + title="{{ .FeedSourceDescription }}" + href="{{ or .FeedSourceHome .FeedSourceLink }}"> + {{ .FeedSourceTitle }} + </a> + </web-ring-item> +{{ end }} |