aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2022-06-04 01:19:32 -0400
committertdro <tdro@noreply.example.com>2022-06-04 01:19:32 -0400
commit99cfb5d9e23bae21bc3b40a77cac1b63767af6e4 (patch)
tree2c40fc84dd4ae12ee2ce043f59a7bf2b4cba2b5c
parentbfbcddf29442a8aa131836072bb1945777b1a75d (diff)
downloadcanory-99cfb5d9e23bae21bc3b40a77cac1b63767af6e4.tar.gz
canory-99cfb5d9e23bae21bc3b40a77cac1b63767af6e4.tar.bz2
canory-99cfb5d9e23bae21bc3b40a77cac1b63767af6e4.zip
themes/default/layouts/partials/feeds-generate: Add short content/description
Delimit from new lines instead of regular expressions.
-rw-r--r--themes/default/layouts/partials/feeds-generate.html23
1 files changed, 15 insertions, 8 deletions
diff --git a/themes/default/layouts/partials/feeds-generate.html b/themes/default/layouts/partials/feeds-generate.html
index f504f9e..6dd94d7 100644
--- a/themes/default/layouts/partials/feeds-generate.html
+++ b/themes/default/layouts/partials/feeds-generate.html
@@ -83,17 +83,19 @@
{{
$feeds = $feeds | append (dict
"FeedContent" ($content | plainify | htmlUnescape)
+ "FeedContentShort" (delimit (first 1 (split ($content | plainify | htmlUnescape) "\n")) " ")
"FeedDate" ($date | plainify | htmlUnescape | time.Format "January 2, 2006")
"FeedDateTime" ($date | plainify | htmlUnescape | time.Format "2006-01-02T15:04:05Z")
"FeedDateTitle" ($date | plainify | htmlUnescape | time.Format "Monday, January 2 2006 at 15:04:05 MST")
- "FeedDescription" (delimit ($description | plainify | htmlUnescape | findRE "^([^.|:|?|!]+)") " ")
+ "FeedDescription" ($description | plainify | htmlUnescape)
+ "FeedDescriptionShort" (delimit (first 1 (split ($description | plainify | htmlUnescape) "\n")) " ")
"FeedLink" ($link | plainify | htmlUnescape)
"FeedName" (delimit ((delimit (first 3 (split ($sourceTitle | plainify | htmlUnescape) " ")) " ") | findRE "^([^.|:|?|!]+)") " " | replaceRE "[^a-zA-Z ]" "")
"FeedSourceDescription" ($sourceDescription | plainify | htmlUnescape)
+ "FeedSourceDomain" (($sourceLink | plainify | htmlUnescape | urls.Parse).Host)
"FeedSourceLink" ($sourceLink | plainify | htmlUnescape)
"FeedSourceTitle" ($sourceTitle | plainify | htmlUnescape)
"FeedTitle" ($title | plainify | htmlUnescape)
- "FeedSourceDomain" (($sourceLink | plainify | htmlUnescape | urls.Parse).Host)
)
}}
@@ -132,18 +134,23 @@
{{ $name := urlize (replace .FeedTitle "/" "-") }}
{{ $path := print "/data/generates/content/" $author.user "/feeds/" $name ".md" }}
- {{ $entitle := .FeedSourceTitle }}
+ {{ $description := .FeedSourceTitle }}
{{ if gt (len .FeedSourceDescription) (len .FeedSourceTitle) }}
- {{ $entitle = .FeedSourceDescription }}
+ {{ $description = .FeedSourceDescription }}
+ {{ end }}
+
+ {{ $content := .FeedContentShort }}
+ {{ if gt (len .FeedTitle) (len .FeedContentShort) }}
+ {{ $content = .FeedTitle }}
{{ end }}
{{ $markdown := resources.ExecuteAsTemplate
$path
(dict
"author" $author.user
- "content" (print (or .FeedDescription .FeedTitle) ".")
+ "content" $content
"date" .FeedDateTime
- "description" $entitle
+ "description" $description
"domain" .FeedSourceDomain
"image" $imageSource
"link" .FeedLink
@@ -160,7 +167,7 @@
<web-ring>
<h1>Web Ring</h1>
<aside>
- {{ range first 3 (sort $feeds "FeedDateTime" "desc") }}
+ {{ range first 3 (uniq (sort $feeds "FeedDateTime" "desc")) }}
<web-ring-item>
<header>
<a
@@ -178,7 +185,7 @@
datetime="{{ .FeedDateTime }}">
{{ .FeedDate }}
</time>
- {{- with (print .FeedDescription ".") -}}
+ {{- with .FeedDescriptionShort -}}
{{ "--" | markdownify }}
{{ . }}
{{- end }}