~subsetpark/subsetpark

ref: 72da2bd93b4f384be91e52953d4350c3cd5e0b0a subsetpark/temple/feed.temple -rw-r--r-- 1.6 KiB
72da2bd9 — Zach Smith Update feed to validate 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?xml version= "1.0" encoding= "utf-8" ?>
<feed xmlns= "http://www.w3.org/2005/Atom" >

<title>{{(get-in args [:blog :title])}}</title>
<link href="https://{{ (get-in args [:blog :url]) }}" />
<link rel="self" href="https://{{ (get-in args [:blog :url]) }}/feed.xml" />
<updated>{{(let [first-post (first (public-posts args))]
              (string/format "%sT00:00:00Z" (first-post :date)))}}</updated>
<author>
  <name>{{(get-in args [:blog :author])}}</name>
</author>

<id>https://{{(get-in args [:blog :url])}}/</id>

{% (loop [post :in (public-posts args)]
     (def full-url (bagatto/format "https://%s%s/posts/%s.html"
                                   (get-in args [:blog :url])
                                   (args :root)
                                   (bagatto/slugify (post :title))))

     (def item ```
                  <entry>
                    <title>%s</title>
                    <link href="%s" />
                    <id>%s</id>
                    <updated>%sT00:00:00.00Z</updated>
                    <content type="text/html" src="%s"/>
                    <summary>%s...</summary>
                  </entry>
                  ```)

     (print (bagatto/format item
                            (post :title)
                            full-url
                            full-url
                            (post :date)
                            full-url
                            (->> (post :body)
                                 (string/split "\n")
                                 (map string/trim)
                                 (filter (complement empty?))
                                 (first))))) %}

</feed>