2024-06-13 04:49:55 +04:00
|
|
|
package web
|
|
|
|
|
|
|
|
import "net/http"
|
2024-06-19 01:08:05 +04:00
|
|
|
import "strings"
|
|
|
|
import "time"
|
2024-06-13 04:49:55 +04:00
|
|
|
|
|
|
|
import "git.arav.su/Arav/dwelling-home/pkg/mindflow"
|
|
|
|
import "git.arav.su/Arav/dwelling-home/pkg/util"
|
|
|
|
|
|
|
|
templ RSS(host, author string, posts []mindflow.Post, r *http.Request) {
|
2024-06-19 01:08:05 +04:00
|
|
|
@templ.Raw("<?xml version=\"1.0\" encoding=\"utf-8\" ?>")
|
|
|
|
<rss version="2.0">
|
|
|
|
<channel>
|
|
|
|
<title>Arav's dwelling</title>
|
|
|
|
<description>What's going on with me and my machines.</description>
|
|
|
|
<language>en-gb</language>
|
|
|
|
<link>{ host }</link>
|
|
|
|
for _, post := range posts {
|
|
|
|
<item>
|
|
|
|
<title>{ post.Title }</title>
|
|
|
|
<category>{ post.Category.Name }</category>
|
|
|
|
<guid>{ post.PostID() }</guid>
|
|
|
|
<pubDate>{ util.ToClientTimezone(post.Date, r).Format(time.RFC1123Z) }</pubDate>
|
|
|
|
<link>{ post.PostURL(r.Host, true) }</link>
|
|
|
|
<author>{ author }</author>
|
|
|
|
<description>
|
|
|
|
@templ.Raw("<![CDATA[")
|
|
|
|
for _, line := range strings.Split(post.Body, "\n") {
|
|
|
|
<p>{ line }</p>
|
|
|
|
}
|
|
|
|
@templ.Raw("]]>")
|
|
|
|
</description>
|
|
|
|
</item>
|
|
|
|
}
|
|
|
|
</channel>
|
|
|
|
</rss>
|
|
|
|
}
|