aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/_default/feeds.html
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2022-05-03 04:25:49 -0400
committertdro <tdro@noreply.example.com>2022-05-03 04:25:49 -0400
commite92dc018e28ba8d44f1c6cbc9fb0b779dec271e6 (patch)
tree3667043819ab91065019dfe3b4ff83ad625c2b49 /themes/default/layouts/_default/feeds.html
downloadcanory-e92dc018e28ba8d44f1c6cbc9fb0b779dec271e6.tar.gz
canory-e92dc018e28ba8d44f1c6cbc9fb0b779dec271e6.tar.bz2
canory-e92dc018e28ba8d44f1c6cbc9fb0b779dec271e6.zip
config.yaml: Commission
Diffstat (limited to 'themes/default/layouts/_default/feeds.html')
-rw-r--r--themes/default/layouts/_default/feeds.html151
1 files changed, 151 insertions, 0 deletions
diff --git a/themes/default/layouts/_default/feeds.html b/themes/default/layouts/_default/feeds.html
new file mode 100644
index 0000000..40442a1
--- /dev/null
+++ b/themes/default/layouts/_default/feeds.html
@@ -0,0 +1,151 @@
+{{ define "styles" }}
+{{ $author := partial "author-user.html" . }}
+<style>
+ {{ partial "styles-navigator.html" (dict "Link" "/") | safeCSS }}
+
+ tab-list a[href="/{{ $author }}/feeds/"] {
+ display: inherit;
+ font-weight: 700;
+ text-decoration: underline;
+ text-decoration-color: #014cc6;
+ text-decoration-color: var(--link);
+ }
+</style>
+{{ end }}
+
+{{ define "middle" }}
+
+ {{ partial "navigator-middle.html"
+ (dict
+ "Title" "Feeds"
+ "Subtitle" (partial "count-media.html" .)
+ "Icon" "arrow-left"
+ "IconLabel" "Back"
+ "Href" "/"
+ "Id" "back"
+ "Context" .
+ )
+ }}
+
+ {{ 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 := "Example Domain" -}}
+ {{- $link := "https://example.com/link" -}}
+ {{- $description := "No description found." -}}
+ {{- $content := "No content found." -}}
+ {{- $sourceTitle := "From Example Domain" -}}
+ {{- $sourceLink := "https://example.com/" -}}
+ {{- $sourceDescription := "The example domain." -}}
+ {{- $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" | plainify | htmlUnescape -}}
+ {{ else -}}
+ {{ $sourceLink = index .link 0 | plainify | htmlUnescape -}}
+ {{ end -}}
+
+ {{ $sourceDescription = .description | plainify | htmlUnescape -}}
+
+ {{ $sourceTitle = .title | plainify | htmlUnescape -}}
+
+ {{ range first $value .item -}}
+ {{ $description = delimit (.description | plainify | htmlUnescape | findRE "^([^.]+)") " " -}}
+ {{ $content = .description | plainify | htmlUnescape -}}
+ {{ $title = .title | plainify | htmlUnescape -}}
+ {{ $link = .link | plainify | htmlUnescape -}}
+ {{ $date = .pubDate | plainify | htmlUnescape | time.Format "January 2, 2006" -}}
+ {{ $dateTime = .pubDate | plainify | htmlUnescape | time.Format "2006-01-02T15:04:05Z" -}}
+ {{ $dateTitle = .pubDate | plainify | htmlUnescape | time.Format "Monday, January 2 2006 at 15:04:05 MST" -}}
+ {{ end -}}
+
+ {{ else -}}
+
+ {{ $sourceLink = index (index .link 0) "-href" | plainify | htmlUnescape -}}
+ {{ $sourceTitle = .title | plainify | htmlUnescape -}}
+ {{ $sourceDescription = .subtitle | plainify | htmlUnescape -}}
+
+ {{ range first $value .entry -}}
+
+ {{ if reflect.IsMap .title -}}
+ {{ $title = index .title "#text" | plainify | htmlUnescape -}}
+ {{ else -}}
+ {{ $title = .title | plainify | htmlUnescape -}}
+ {{ end -}}
+
+ {{ $date = .updated | plainify | htmlUnescape | time.Format "January 2, 2006" -}}
+ {{ $dateTime = .updated | plainify | htmlUnescape | time.Format "2006-01-02T15:04:05Z" -}}
+ {{ $dateTitle = .updated | plainify | htmlUnescape | time.Format "Monday, January 2 2006 at 15:04:05 MST" -}}
+
+ {{ $link = .id -}}
+ {{ with .content -}}
+ {{ $description = delimit ((index . "#text") | plainify | htmlUnescape | findRE "^([^.]+)") " " -}}
+ {{ $content = (index . "#text") | plainify | htmlUnescape -}}
+ {{ end -}}
+ {{ with .summary -}}
+ {{ $description = delimit ((index . "#text") | plainify | htmlUnescape | findRE "^([^.]+)") " " -}}
+ {{ $content = (index . "#text") | plainify | htmlUnescape -}}
+ {{ end -}}
+ {{ end -}}
+
+ {{ end -}}
+
+ {{
+ $feeds = $feeds | append (dict
+ "FeedTitle" $title
+ "FeedLink" $link
+ "FeedDescription" $description
+ "FeedContent" $content
+ "FeedSourceTitle" $sourceTitle
+ "FeedSourceLink" $sourceLink
+ "FeedSourceDescription" $sourceDescription
+ "FeedDate" $date
+ "FeedDateTime" $dateTime
+ "FeedDateTitle" $dateTitle
+ )
+ }}
+
+ {{ 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" (or .FeedDescription .FeedTitle)
+ "FeedDate" .FeedDate
+ "FeedDateTime" .FeedDateTime
+ "FeedDateTitle" .FeedDateTime
+ "FeedWordCount" ((or .FeedDescription .FeedTitle) | countwords)
+ "FeedLink" .FeedLink
+ )
+ }}
+ {{ end }}
+
+ {{ partial "pagination.html" . }}
+
+{{ end }}
+
+{{ define "right" }}
+ {{- partial "navigator-right.html" . -}}
+{{ end }}