2013-04-28 10:11:38 -04:00
|
|
|
(defpackage :coleslaw-sitemap
|
2013-04-27 02:16:22 +08:00
|
|
|
(:use :cl)
|
2014-04-28 12:31:22 -04:00
|
|
|
(:import-from :coleslaw #:*config*
|
2014-05-08 11:37:10 -04:00
|
|
|
#:index
|
2014-04-28 12:31:22 -04:00
|
|
|
#:deploy
|
|
|
|
#:page-url
|
|
|
|
#:theme-fn
|
2014-05-08 11:37:10 -04:00
|
|
|
#:write-document)
|
2014-04-28 12:31:22 -04:00
|
|
|
(:import-from :alexandria #:hash-table-values)
|
2013-04-27 02:16:22 +08:00
|
|
|
(:export #:enable))
|
|
|
|
|
2013-04-28 10:11:38 -04:00
|
|
|
(in-package :coleslaw-sitemap)
|
2013-04-27 02:16:22 +08:00
|
|
|
|
2014-05-08 11:37:10 -04:00
|
|
|
(defclass sitemap (index)
|
|
|
|
((urls :initarg :urls :reader urls)))
|
|
|
|
|
|
|
|
(defmethod page-url ((object sitemap)) "sitemap.xml")
|
|
|
|
|
2013-04-27 02:16:22 +08:00
|
|
|
(defmethod deploy :before (staging)
|
2014-04-15 19:05:52 -04:00
|
|
|
"Render sitemap.xml under document root."
|
2013-05-18 12:06:58 +02:00
|
|
|
(declare (ignore staging))
|
2014-05-08 11:37:10 -04:00
|
|
|
(let* ((urls (mapcar #'page-url (hash-table-values coleslaw::*site*)))
|
|
|
|
(sitemap (make-instance 'sitemap :urls (append '("" "sitemap.xml") urls))))
|
|
|
|
(write-document sitemap (theme-fn 'sitemap "sitemap"))))
|
2013-04-27 02:16:22 +08:00
|
|
|
|
|
|
|
(defun enable ())
|