Created
February 23, 2017 12:33
-
-
Save priyadarshan/939c1df7df24835d54d68e5efee77220 to your computer and use it in GitHub Desktop.
Generate a sitemap using cxml library
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun generate-sitemap (urls) | |
"Creates the sitemap file" | |
(with-open-file (file "/tmp/sitemap.xml" | |
:direction :output | |
:element-type :default | |
:if-exists :supersede) | |
(cxml:with-xml-output (cxml:make-octet-stream-sink file :indentation 1 :canonical nil) | |
(cxml:with-element "urlset" | |
(cxml:attribute "xmlns" "http://www.sitemaps.org/schemas/sitemap/0.9") | |
;; create the tags | |
(dolist (item urls) | |
(cxml:with-element "url" | |
(cxml:with-element "loc" | |
(cxml:text item)) | |
(cxml:with-element "changefreq" | |
(cxml:text "daily")))))))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment