From dc4876e67afbce271ec84ad4681de001ea34c6d5 Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Wed, 10 Dec 2008 21:14:59 +0100 Subject: Atom feed: Omit body data for old journal entries. darcs-hash:bfebd08ac474795e3dbf49c7c0fbdc8d2f7a00ae --- journal.lisp | 47 ++++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-) (limited to 'journal.lisp') diff --git a/journal.lisp b/journal.lisp index 1d9aa43..8b36dc2 100755 --- a/journal.lisp +++ b/journal.lisp @@ -86,27 +86,32 @@ ("type" "application/atom+xml") ("href" ,(link-to :view-atom-feed :absolute t))))) - (dolist (journal-entry (select 'journal-entry - :order-by '(([date] :desc)) - :flatp t)) - (with-slots (title date body categories last-modification id) - journal-entry - (with-tag ("entry") - (emit-simple-tags :title title - :id (format nil "urn:uuid:~(~A~)" - (uuid-of journal-entry)) - :updated (atom-time (or last-modification date)) - :published (atom-time date)) - (with-tag ("link" `(("rel" "alternate") - ("type" "text/html") - ("href" ,(link-to :view - :post-id id - :absolute t))))) - (with-tag ("content" `(("type" "xhtml") - ("xml:lang" "de") - ("xml:base" ,(link-to :index :absolute t)))) - (with-tag ("div" '(("xmlns" "http://www.w3.org/1999/xhtml"))) - (xml-as-is (journal-markup->html (body-of journal-entry))))))))))) + (let ((number 0)) + (dolist (journal-entry (select 'journal-entry + :order-by '(([date] :desc)) + :flatp t)) + (incf number) + (with-slots (title date body categories last-modification id) + journal-entry + (with-tag ("entry") + (emit-simple-tags :title title + :id (format nil "urn:uuid:~(~A~)" + (uuid-of journal-entry)) + :updated (atom-time (or last-modification date)) + :published (atom-time date)) + (with-tag ("link" `(("rel" "alternate") + ("type" "text/html") + ("href" ,(link-to :view + :post-id id + :absolute t))))) + (unless (> number 8) + ;; We only include the body for the most recent + ;; posts in order to save bandwidth. + (with-tag ("content" `(("type" "xhtml") + ("xml:lang" "de") + ("xml:base" ,(link-to :index :absolute t)))) + (with-tag ("div" '(("xmlns" "http://www.w3.org/1999/xhtml"))) + (xml-as-is (journal-markup->html (body-of journal-entry))))))))))))) #.(restore-sql-reader-syntax-state)) -- cgit v1.2.3