|
|
|
@ -1446,6 +1446,42 @@
|
|
|
|
|
`(:alert ,(utils:get-and-reset-alert) |
|
|
|
|
:nav-menu ,(nera:nav-menu-slugs) |
|
|
|
|
:system-data ,(nera:system-data))))) |
|
|
|
|
|
|
|
|
|
(defroute ("/sitemap.xml" :method :GET) () |
|
|
|
|
(setf (getf (response-headers *response*) :content-type) "application/xml") |
|
|
|
|
(with-output-to-string (stream) |
|
|
|
|
(let ((pages (nera:get-all-pages)) |
|
|
|
|
(entries (nera:get-all-archive-entries)) |
|
|
|
|
(root-url (utils:build-url-root ningle:*request*))) |
|
|
|
|
(xml-emitter:with-xml-output (stream :encoding "utf-8") |
|
|
|
|
(xml-emitter:with-simple-tag |
|
|
|
|
("urlset" |
|
|
|
|
nil |
|
|
|
|
"http://www.sitemaps.org/schemas/sitemap/0.9") |
|
|
|
|
;; Lists all the pages first. |
|
|
|
|
;; The 'unless' block is to remove pages which are not wanting to be |
|
|
|
|
;; part of a search engine's crawler results. |
|
|
|
|
(loop for item in pages |
|
|
|
|
do |
|
|
|
|
(unless (or (string= "sign-up" (pages::slug-of item)) |
|
|
|
|
(string= "login" (pages::slug-of item))) |
|
|
|
|
(xml-emitter:with-tag ("url") |
|
|
|
|
(xml-emitter:emit-simple-tags |
|
|
|
|
:loc (format nil "~a/view/page/~a" |
|
|
|
|
root-url (pages::slug-of item)) |
|
|
|
|
:lastmod |
|
|
|
|
(format nil "~a" (mito.dao.mixin:object-updated-at item)))))) |
|
|
|
|
;; Lists all the archive entries second. |
|
|
|
|
(loop for item in entries |
|
|
|
|
do |
|
|
|
|
(xml-emitter:with-tag ("url") |
|
|
|
|
(xml-emitter:emit-simple-tags |
|
|
|
|
:loc (format nil "~a/view/archive/~a" |
|
|
|
|
root-url (archive::slug-of item)) |
|
|
|
|
:lastmod |
|
|
|
|
(format nil "~a" |
|
|
|
|
(mito.dao.mixin:object-updated-at item)))))))))) |
|
|
|
|
|
|
|
|
|
;; |
|
|
|
|
;; Error pages |
|
|
|
|
|
|
|
|
|