<?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]) }}"/>
  <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>
                  </entry>
                  ```)
        
        (print (bagatto/format item
                               (post :title)
                               full-url
                               full-url
                               (post :date)))) %}

</feed>
