use latest date in rss

This commit is contained in:
Rhiannon Morris 2022-01-04 20:13:09 +01:00
parent 585706f1c5
commit ca53ab5b8e

View file

@ -47,16 +47,17 @@ make' root ginfo@(GalleryInfo {title, desc, prefix}) output infos = [b|@0
Just o -> [b|<atom:link href="$link/$o" rel="self" />|] Just o -> [b|<atom:link href="$link/$o" rel="self" />|]
makeItem :: Strict.Text -> FilePath -> Bool -> FilePath -> Info -> Builder makeItem :: Strict.Text -> FilePath -> Bool -> FilePath -> Info -> Builder
makeItem root prefix nsfw path i@(Info {title, date, artist}) = [b|@4 makeItem root prefix nsfw path i@(Info {title, artist}) = [b|@4
<item> <item>
<title>$title</title> <title>$title$up</title>
<link>$link</link> <link>$link</link>
<guid>$link</guid> <guid>$link</guid>
$descArtist' $descArtist'
<pubDate>$date'</pubDate> <pubDate>$date</pubDate>
</item> </item>
|] |]
where where
up = if #updated i nsfw then [b| (updated)|] else ""
dir = takeDirectory path dir = takeDirectory path
link = [b|$root/$prefix/$dir|] link = [b|$root/$prefix/$dir|]
artist' = ifJust artist \case artist' = ifJust artist \case
@ -73,7 +74,7 @@ makeItem root prefix nsfw path i@(Info {title, date, artist}) = [b|@4
</description> </description>
|] |]
else "" else ""
date' = formatRSS date date = formatRSS $ #latestDate i nsfw
makeDesc :: Desc -> Builder makeDesc :: Desc -> Builder
makeDesc NoDesc = "" makeDesc NoDesc = ""