From e5a40b67a7537ef9a1e49f467840b29c648d9567 Mon Sep 17 00:00:00 2001 From: Brit Butler Date: Wed, 16 Apr 2014 11:03:23 -0400 Subject: [PATCH] Update all page-url calls to only use the slug. --- docs/hacking.md | 2 +- src/indexes.lisp | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/hacking.md b/docs/hacking.md index a7c02f8..2912654 100644 --- a/docs/hacking.md +++ b/docs/hacking.md @@ -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. diff --git a/src/indexes.lisp b/src/indexes.lisp index d6a0642..35e52a5 100644 --- a/src/indexes.lisp +++ b/src/indexes.lisp @@ -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))))