Skip to content
Clojure library for sitemap generation.
Branch: master
Clone or download
Latest commit ae020fb Feb 24, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
resources/org/sitemaps/schemas/0.9 Add validate-sitemap function to core Jul 22, 2014
src/sitemap Removed unused, invalid deps from validator ns Jan 12, 2019
test-resources Add validate-sitemap function to core Jul 22, 2014
test/sitemap validate-sitemap accepts String or File as input. Jul 23, 2014
.travis.yml add travis config file Jun 7, 2013
LICENSE Create LICENSE Sep 20, 2013 update version Feb 25, 2019
project.clj update version Feb 25, 2019


Clojure library for generating sitemaps.

Build Status Dependencies Status Downloads

Sitemaps XML format described on

Sitemap library accepts Clojure list/vectore data sctructure and produces sitemap XML as string.

Optionally sitemap XML can be saved to file using provided path.

Input data structure should be in the following format:

  {:loc ""
   :lastmod "2013-05-31"
   :changefreq "monthly"
   :priority "0.8"}
  {:loc ""
   :lastmod "2013-06-01"
   :changefreq "monthly"
   :priority "0.9"}]

So it should be sequence of hash maps. Each map should have following keys:

  • loc - url to the page
  • lastmod - date when page was modified in YYYY-MM-DD format
  • changefreq - how often page content will be changed (daily, weekly, monthly, never)
  • priority - what is the priority of this page on the site (from 0 to 1)

Note that only 'loc' key is mandatory.

Please refer to documentation for values' formats of each key.


[sitemap "0.4.0"]


user=> (use 'sitemap.core)
user=> (generate-sitemap [{:loc ""
                         :lastmod "2013-05-31"
                         :changefreq "monthly"
                         :priority "0.8"}
                        {:loc ""
                         :lastmod "2013-06-01"
                         :changefreq "monthly"
                         :priority "0.9"}])

generates the following XML:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="">


We recommend you to validate your sitemap before submitting it to Google Webmaster tools. You can use this library and there are also plenty of online validators.


This library can validate the generated XML against version 0.9 of the schema.

(use 'sitemap.core)
(import '
  (generate-sitemap [{:loc ""
                      :lastmod "2014-07-23"
                      :changefreq "monthly"
                      :priority "0.5"}])
  (save-sitemap (File. "/tmp/sitemap.xml"))
  (format "You have %d errors"))
; "You have 0 errors"

Validation errors are reported as a list of SAXParseException:

  (generate-sitemap [{:loc ""
                      :lastmod "2000-00-00"
                      :changefreq "monthly"
                      :priority "0.8"}])
  (save-sitemap (File. "/tmp/sitemap-bad.xml"))
  (map #(.getMessage %)))
;("cvc-datatype-valid.1.2.3: '2000-00-00' is not a valid value of union type 'lastmod'."
; "cvc-type.3.1.3: The value '2000-00-00' of element 'lastmod' is not valid.")


We love contributions. Please submit your pull requests.


Copyright © 2013-2019 Hashobject Ltd (

Distributed under the Eclipse Public License.

You can’t perform that action at this time.