blob: 473af3553cf2c9fddc51dd3001b5fce8045172b0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
{{ define "styles" }}
{{ $author := partial "author-user.html" . }}
<style>
{{ partial "styles-navigator.html" (dict "Link" "/") | safeCSS }}
tab-list a[href="{{ .Site.BaseURL }}/{{ $author }}/feeds/"] {
color: #111;
color: var(--foreground);
display: inherit;
font-weight: 700;
text-decoration-color: #014cc6;
text-decoration-color: var(--link);
text-decoration: underline;
}
</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 := "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
)
}}
{{ end }}
{{ partial "pagination.html" . }}
{{ end }}
{{ define "right" }}
{{- partial "navigator-right.html" . -}}
{{ end }}
|