Update all page-url calls to only use the slug.

This commit is contained in:
Brit Butler 2014-04-16 11:03:23 -04:00
parent 98be18c1f8
commit e5a40b67a7
2 changed files with 10 additions and 8 deletions

View file

@ -74,7 +74,7 @@ implement them by eql-specializing on the class, e.g.
- `page-url`: Generate a unique, relative path for the object on the site
sans file extension. An :around method adds that later. The `slug` slot
on the object is generally used to hold a portion of the unique
on the object is conventionally used to hold a portion of the unique
identifier. i.e. `(format nil "posts/~a" (content-slug object))`.
- `render`: A method that calls the appropriate template with `theme-fn`,
passing it any needed arguments and returning rendered HTML.

View file

@ -91,12 +91,14 @@
((format :initform nil :initarg :format :accessor feed-format)))
(defmethod page-url ((object feed))
(format nil "~(~a~).xml" (feed-format object)))
(format nil "~a.xml" (index-slug object)))
(defmethod discover ((doc-type (eql (find-class 'feed))))
(let ((content (take-up-to 10 (by-date (find-all 'post)))))
(let ((content (by-date (find-all 'post))))
(dolist (format '(rss atom))
(let ((feed (make-instance 'feed :content content :format format)))
(let ((feed (make-instance 'feed :format format
:content (take-up-to 10 content)
:slug (format nil "~(~a~)" format))))
(add-document feed)))))
(defmethod publish ((doc-type (eql (find-class 'feed))))
@ -108,16 +110,16 @@
(defclass tag-feed (feed) ())
(defmethod page-url ((object tag-feed))
(format nil "tag/~a~(~a~).xml" (index-slug object) (feed-format object)))
(format nil "tag/~a.xml" (index-slug object)))
(defmethod discover ((doc-type (eql (find-class 'tag-feed))))
(let ((content (by-date (find-all 'post))))
(dolist (tag (feeds *config*))
(let ((tagged (remove-if-not (lambda (x) (tag-p tag x)) content)))
(dolist (format '(rss atom))
(let ((feed (make-instance 'tag-feed :content (take-up-to 10 tagged)
:format format
:slug tag)))
(let ((feed (make-instance 'tag-feed :format format
:content (take-up-to 10 tagged)
:slug (format nil "~a-~(~a~)" tag format))))
(add-document feed)))))))
(defmethod publish ((doc-type (eql (find-class 'tag-feed))))