The following Ruby 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.

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="">
  <%- pages.each do |page| -%>
    <loc><%= page[:absolute_url] %></loc>
    <lastmod><%= (page["DATE"] ? DateTime.parse(page["DATE"]) : %></lastmod>
  <%- end -%>

  load '_scripts/metadata.rb'
  require 'erb'

  pages = Metadata::collect ".", url: ""

  renderer =, nil, "-")
  content = renderer.result(binding)
  puts content

Author: Adolfo Villafiorita

Last modified: 2021-02-28 Sun 16:01 (created on: 2020-03-11 Wed 00:00)

Published: 2021-02-28 Sun 20:00