add sitemap.lisp in plugins
This commit is contained in:
parent
488191b237
commit
e28729b0de
2 changed files with 30 additions and 1 deletions
29
plugins/sitemap.lisp
Normal file
29
plugins/sitemap.lisp
Normal file
|
@ -0,0 +1,29 @@
|
|||
(defpackage :coleslaw-sitemap
|
||||
(:use :cl)
|
||||
(:import-from :coleslaw
|
||||
#:*config*
|
||||
#:deploy
|
||||
#:domain
|
||||
#:find-all
|
||||
#:page-url
|
||||
#:rel-path
|
||||
#:staging-dir
|
||||
#:theme-fn
|
||||
#:write-page)
|
||||
(:export #:enable))
|
||||
|
||||
(in-package :coleslaw-sitemap)
|
||||
|
||||
(defmethod deploy :before (staging)
|
||||
"Render sitemap.xml under document root"
|
||||
(let* ((urls (append '("" "sitemap.xml") ; empty string is for root url
|
||||
(mapcar #'page-url (find-all 'coleslaw:post)))))
|
||||
(write-page (rel-path (staging-dir *config*) "sitemap.xml")
|
||||
(funcall (theme-fn :sitemap "feeds")
|
||||
(list :domain (domain *config*)
|
||||
:urls urls
|
||||
:pubdate (local-time:format-rfc3339-timestring
|
||||
nil
|
||||
(local-time:now)))))))
|
||||
|
||||
(defun enable ())
|
|
@ -20,7 +20,7 @@
|
|||
(defmethod page-url ((object index))
|
||||
(index-id object))
|
||||
(defmethod page-url ((object tag-index))
|
||||
(format nil "tags/~a" (index-id object)))
|
||||
(format nil "tag/~a" (index-id object)))
|
||||
(defmethod page-url ((object date-index))
|
||||
(format nil "date/~a" (index-id object)))
|
||||
(defmethod page-url ((object int-index))
|
||||
|
|
Loading…
Add table
Reference in a new issue