The following code generates the XML sitemap of my website. It is composed of two parts:

Org Mode is instructed to generate the sitemap.xml file upon execution of this source block. This block is executed when the website is build and this file exported to HTML.

  (require 'templatel)
  (org-babel-load-file "project-specification/")

  ;; get metadata of all the files from notes
  (setq metadata (files-metadata "notes" "." ""))

  (setq atom-template  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<urlset xmlns=\"\">
  {% for page in pages %}
    <loc>{{ page.ABSOLUTE_URL }}</loc>
    <lastmod>{{ page.DATE_ISO8601 }}</lastmod>
  {% endfor %}

  (templatel-render-string atom-template
                           (list (cons "pages" metadata)))