From d2aa53e290395767bc6d818e1f64045ee531d744 Mon Sep 17 00:00:00 2001 From: tdro Date: Tue, 24 May 2022 20:52:46 -0400 Subject: themes/default/layouts/_default/feeds: Cleanup duplication sprawl --- themes/default/layouts/_default/feeds.html | 67 +++++++++++++++--------------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/themes/default/layouts/_default/feeds.html b/themes/default/layouts/_default/feeds.html index 02201fb..5800ae3 100644 --- a/themes/default/layouts/_default/feeds.html +++ b/themes/default/layouts/_default/feeds.html @@ -60,51 +60,52 @@ {{ with .channel -}} {{ if reflect.IsMap (index .link 0) -}} - {{ $sourceLink = index (index .link 0) "-href" | plainify | htmlUnescape -}} + {{ $sourceLink = index (index .link 0) "-href" -}} {{ else -}} - {{ $sourceLink = index .link 0 | plainify | htmlUnescape -}} + {{ $sourceLink = index .link 0 -}} {{ end -}} - {{ $sourceDescription = .description | plainify | htmlUnescape -}} + {{ $sourceDescription = .description -}} - {{ $sourceTitle = .title | plainify | htmlUnescape -}} + {{ $sourceTitle = .title -}} {{ 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" -}} + {{ $description = .description -}} + {{ $content = .description -}} + {{ $title = .title -}} + {{ $link = .link -}} + {{ $date = .pubDate -}} + {{ $dateTime = .pubDate -}} + {{ $dateTitle = .pubDate -}} {{ end -}} {{ else -}} - {{ $sourceLink = index (index .link 0) "-href" | plainify | htmlUnescape -}} - {{ $sourceTitle = .title | plainify | htmlUnescape -}} - {{ $sourceDescription = .subtitle | plainify | htmlUnescape -}} + {{ $sourceLink = index (index .link 0) "-href" -}} + {{ $sourceTitle = .title -}} + {{ $sourceDescription = .subtitle -}} {{ range first $value .entry -}} {{ if reflect.IsMap .title -}} - {{ $title = index .title "#text" | plainify | htmlUnescape -}} + {{ $title = index .title "#text" -}} {{ else -}} - {{ $title = .title | plainify | htmlUnescape -}} + {{ $title = .title -}} {{ 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" -}} + {{ $date = .updated -}} + {{ $dateTime = .updated -}} + {{ $dateTitle = .updated -}} {{ $link = .id -}} + {{ with .content -}} - {{ $description = delimit ((index . "#text") | plainify | htmlUnescape | findRE "^([^.]+)") " " -}} - {{ $content = (index . "#text") | plainify | htmlUnescape -}} + {{ $description = index . "#text" -}} + {{ $content = index . "#text" -}} {{ end -}} {{ with .summary -}} - {{ $description = delimit ((index . "#text") | plainify | htmlUnescape | findRE "^([^.]+)") " " -}} - {{ $content = (index . "#text") | plainify | htmlUnescape -}} + {{ $description = index . "#text" -}} + {{ $content = index . "#text" -}} {{ end -}} {{ end -}} @@ -112,16 +113,16 @@ {{ $feeds = $feeds | append (dict - "FeedTitle" $title - "FeedLink" $link - "FeedDescription" $description - "FeedContent" $content - "FeedSourceTitle" $sourceTitle - "FeedSourceLink" $sourceLink - "FeedSourceDescription" $sourceDescription - "FeedDate" $date - "FeedDateTime" $dateTime - "FeedDateTitle" $dateTitle + "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") ) }} -- cgit v1.2.3