summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Benkard <code@mail.matthias.benkard.de>2008-12-10 21:14:59 +0100
committerMatthias Benkard <code@mail.matthias.benkard.de>2008-12-10 21:14:59 +0100
commitdc4876e67afbce271ec84ad4681de001ea34c6d5 (patch)
tree94a52396f2fcb57b9cd0e66155c317cb2ccdf6cb
parent488059fee1ffb5b9aa3882561edf171a46118856 (diff)
Atom feed: Omit body data for old journal entries.
darcs-hash:bfebd08ac474795e3dbf49c7c0fbdc8d2f7a00ae
-rwxr-xr-xjournal.lisp47
1 files changed, 26 insertions, 21 deletions
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))