aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/_default/feeds.html
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2022-05-25 19:18:40 -0400
committertdro <tdro@noreply.example.com>2022-05-25 19:18:40 -0400
commit76fcd575e61a0f0e4ce602387d9a3b6098a23884 (patch)
treeebe4b9bae4d08c9f1cc402cd615229eba63c9eb2 /themes/default/layouts/_default/feeds.html
parent8710bcdc76615374cf40af2fb8ea2304f9cdaee1 (diff)
downloadcanory-76fcd575e61a0f0e4ce602387d9a3b6098a23884.tar.gz
canory-76fcd575e61a0f0e4ce602387d9a3b6098a23884.tar.bz2
canory-76fcd575e61a0f0e4ce602387d9a3b6098a23884.zip
themes/default/layouts: Multiplex RSS feeds
Use one feed fetching logic and generate feeds as markdown. Due to generation step hugo has to run twice to fully generate all static content.
Diffstat (limited to 'themes/default/layouts/_default/feeds.html')
-rw-r--r--themes/default/layouts/_default/feeds.html116
1 files changed, 4 insertions, 112 deletions
diff --git a/themes/default/layouts/_default/feeds.html b/themes/default/layouts/_default/feeds.html
index 473af35..238887f 100644
--- a/themes/default/layouts/_default/feeds.html
+++ b/themes/default/layouts/_default/feeds.html
@@ -31,122 +31,14 @@
{{ partial "profile.html" . }}
- {{- $author := index .Site.Data.authors ((or .Params.author .Site.Author.default.user) | default "default") -}}
-
- {{ $feeds := slice }}
-
- {{ range $key, $value := (seq 3) }}
- {{ range first 5 $author.webring.rss -}}
-
- {{ with resources.GetRemote . }}
- {{- with .Err -}}
- {{- warnf "%s" . -}}
- {{- end -}}
- {{ end }}
-
- {{ with resources.GetRemote . | transform.Unmarshal -}}
-
- {{- $title := "No Title Found" -}}
- {{- $link := "https://example.com/link" -}}
- {{- $description := "No description found." -}}
- {{- $content := "No content found." -}}
- {{- $sourceTitle := "No source title found" -}}
- {{- $sourceLink := "https://example.com/" -}}
- {{- $sourceDescription := "No source description found." -}}
- {{- $date := now.Format "January 2, 2006" -}}
- {{- $dateTime := now.Format "2006-01-02T15:04:05Z" -}}
- {{- $dateTitle := now.Format "Monday, January 2 2006 at 15:04:05 MST" -}}
-
- {{ with .channel -}}
-
- {{ if reflect.IsMap (index .link 0) -}}
- {{ $sourceLink = index (index .link 0) "-href" -}}
- {{ else -}}
- {{ $sourceLink = index .link 0 -}}
- {{ end -}}
-
- {{ $sourceDescription = .description -}}
-
- {{ $sourceTitle = .title -}}
-
- {{ range first $value .item -}}
- {{ $description = .description -}}
- {{ $content = .description -}}
- {{ $title = .title -}}
- {{ $link = .link -}}
- {{ $date = .pubDate -}}
- {{ $dateTime = .pubDate -}}
- {{ $dateTitle = .pubDate -}}
- {{ end -}}
-
- {{ else -}}
-
- {{ $sourceLink = index (index .link 0) "-href" -}}
- {{ $sourceTitle = .title -}}
- {{ $sourceDescription = .subtitle -}}
-
- {{ range first $value .entry -}}
-
- {{ if reflect.IsMap .title -}}
- {{ $title = index .title "#text" -}}
- {{ else -}}
- {{ $title = .title -}}
- {{ end -}}
-
- {{ $date = .updated -}}
- {{ $dateTime = .updated -}}
- {{ $dateTitle = .updated -}}
-
- {{ $link = .id -}}
-
- {{ with .content -}}
- {{ $description = index . "#text" -}}
- {{ $content = index . "#text" -}}
- {{ end -}}
- {{ with .summary -}}
- {{ $description = index . "#text" -}}
- {{ $content = index . "#text" -}}
- {{ end -}}
- {{ end -}}
-
- {{ end -}}
-
- {{
- $feeds = $feeds | append (dict
- "FeedTitle" ($title | plainify | htmlUnescape)
- "FeedLink" ($link | plainify | htmlUnescape)
- "FeedDescription" (delimit ($description | plainify | htmlUnescape | findRE "^([^.|?|!]+)") " ")
- "FeedContent" ($content | plainify | htmlUnescape)
- "FeedSourceTitle" ($sourceTitle | plainify | htmlUnescape)
- "FeedSourceLink" ($sourceLink | plainify | htmlUnescape)
- "FeedSourceDescription" ($sourceDescription | plainify | htmlUnescape)
- "FeedDate" ($date | plainify | htmlUnescape | time.Format "January 2, 2006")
- "FeedDateTime" ($dateTime | plainify | htmlUnescape | time.Format "2006-01-02T15:04:05Z")
- "FeedDateTitle" ($dateTitle | plainify | htmlUnescape | time.Format "Monday, January 2 2006 at 15:04:05 MST")
- )
- }}
-
- {{ end }}
- {{ end }}
- {{ end }}
-
- {{ range sort $feeds "FeedDateTime" "desc" }}
- {{ partial "card-feed.html" (dict
- "FeedName" ((delimit (first 3 (split .FeedSourceTitle " ")) " ") | replaceRE "[^a-zA-Z ]" "")
- "FeedSourceDomain" (.FeedSourceLink | replaceRE "^https?://([^/]+).*" "$1")
- "FeedSourceLink" .FeedSourceLink
- "FeedContent" (print (or .FeedDescription .FeedTitle) ".")
- "FeedDate" .FeedDate
- "FeedDateTime" .FeedDateTime
- "FeedDateTitle" .FeedDateTitle
- "FeedWordCount" ((or .FeedDescription .FeedTitle) | countwords)
- "FeedLink" .FeedLink
- )
- }}
+ {{ range where .Paginator.Pages ".Params.hidden" "ne" "true" }}
+ {{ .Render "summary" }}
{{ end }}
{{ partial "pagination.html" . }}
+ {{ partial "feeds-generate" . }}
+
{{ end }}
{{ define "right" }}