Update all page-url calls to only use the slug.
This commit is contained in:
parent
98be18c1f8
commit
e5a40b67a7
2 changed files with 10 additions and 8 deletions
|
@ -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
|
- `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
|
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))`.
|
identifier. i.e. `(format nil "posts/~a" (content-slug object))`.
|
||||||
- `render`: A method that calls the appropriate template with `theme-fn`,
|
- `render`: A method that calls the appropriate template with `theme-fn`,
|
||||||
passing it any needed arguments and returning rendered HTML.
|
passing it any needed arguments and returning rendered HTML.
|
||||||
|
|
|
@ -91,12 +91,14 @@
|
||||||
((format :initform nil :initarg :format :accessor feed-format)))
|
((format :initform nil :initarg :format :accessor feed-format)))
|
||||||
|
|
||||||
(defmethod page-url ((object feed))
|
(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))))
|
(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))
|
(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)))))
|
(add-document feed)))))
|
||||||
|
|
||||||
(defmethod publish ((doc-type (eql (find-class 'feed))))
|
(defmethod publish ((doc-type (eql (find-class 'feed))))
|
||||||
|
@ -108,16 +110,16 @@
|
||||||
(defclass tag-feed (feed) ())
|
(defclass tag-feed (feed) ())
|
||||||
|
|
||||||
(defmethod page-url ((object tag-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))))
|
(defmethod discover ((doc-type (eql (find-class 'tag-feed))))
|
||||||
(let ((content (by-date (find-all 'post))))
|
(let ((content (by-date (find-all 'post))))
|
||||||
(dolist (tag (feeds *config*))
|
(dolist (tag (feeds *config*))
|
||||||
(let ((tagged (remove-if-not (lambda (x) (tag-p tag x)) content)))
|
(let ((tagged (remove-if-not (lambda (x) (tag-p tag x)) content)))
|
||||||
(dolist (format '(rss atom))
|
(dolist (format '(rss atom))
|
||||||
(let ((feed (make-instance 'tag-feed :content (take-up-to 10 tagged)
|
(let ((feed (make-instance 'tag-feed :format format
|
||||||
:format format
|
:content (take-up-to 10 tagged)
|
||||||
:slug tag)))
|
:slug (format nil "~a-~(~a~)" tag format))))
|
||||||
(add-document feed)))))))
|
(add-document feed)))))))
|
||||||
|
|
||||||
(defmethod publish ((doc-type (eql (find-class 'tag-feed))))
|
(defmethod publish ((doc-type (eql (find-class 'tag-feed))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue