@@ -138,36 +138,37 @@ module RssFeed = {
138
138
})
139
139
-> Belt .Option .getWithDefault ("" )
140
140
141
- let itemsStr = Belt . Array . reduce ( items , "" , ( acc , item ) => {
142
- let { title , pubDate , description , href } = item
143
-
144
- let descriptionElement = switch description {
145
- | "" => ""
146
- | desc => j ` <description>
147
- <![CDATA[$desc]]>
148
- </description>`
149
- }
141
+ let itemsStr =
142
+ items
143
+ -> Js . Array2 . map (({ title , pubDate , description , href }) => {
144
+ let descriptionElement = switch description {
145
+ | "" => ""
146
+ | desc => j ` <description>
147
+ <![CDATA[$desc]]>
148
+ </description>`
149
+ }
150
150
151
- // TODO: convert pubdate to string
152
- let dateStr = pubDate -> dateToUTCString
153
- j ` ${acc}
154
- <item>
155
- <title> <![CDATA[$title]]></title>
156
- <link> $href </link>
157
- <guid> $href </guid>
158
- $descriptionElement
159
- <pubDate>$dateStr</pubDate>
160
- </item>`
161
- })
151
+ // TODO: convert pubdate to string
152
+ let dateStr = pubDate -> dateToUTCString
153
+ j `
154
+ <item>
155
+ <title> <![CDATA[$title]]></title>
156
+ <link> $href </link>
157
+ <guid> $href </guid>
158
+ $descriptionElement
159
+ <pubDate>$dateStr</pubDate>
160
+ </item>`
161
+ })
162
+ -> Js .Array2 .joinWith ("\n " )
162
163
163
164
let ret = j ` <?xml version="1.0" encoding="utf-8" ?>
164
165
<rss version="2.0">
165
166
<channel>
166
- <title>$siteTitle</title>
167
- <link>https://rescript-lang.org</link>
168
- <description>$siteDescription</description>
169
- <language>en</language>
170
- $latestPubDateElement
167
+ <title>$siteTitle</title>
168
+ <link>https://rescript-lang.org</link>
169
+ <description>$siteDescription</description>
170
+ <language>en</language>
171
+ $latestPubDateElement
171
172
$itemsStr
172
173
</channel>
173
174
</rss>` //rescript-lang.org</link>
0 commit comments