diff --git a/src/coleslaw.lisp b/src/coleslaw.lisp index d2899cf..cadd7b7 100644 --- a/src/coleslaw.lisp +++ b/src/coleslaw.lisp @@ -35,7 +35,7 @@ Additional args to render CONTENT can be passed via RENDER-ARGS." (run-program "cp -R ~a ." dir))) (render-posts) (render-indices) - (render-feeds))) + (render-feeds (feeds *config*)))) (defgeneric deploy (staging) (:documentation "Deploy the STAGING dir, updating the .prev and .curr symlinks.") diff --git a/src/config.lisp b/src/config.lisp index d85928f..ba79a86 100644 --- a/src/config.lisp +++ b/src/config.lisp @@ -4,6 +4,7 @@ ((author :initarg :author :initform "" :accessor author) (deploy :initarg :deploy :initform nil :accessor deploy) (domain :initarg :domain :initform "" :accessor domain) + (feeds :initarg :feeds :initform nil :accessor feeds) (license :initarg :license :initform "CC-BY-SA" :accessor license) (plugins :initarg :plugins :initform '() :accessor plugins) (repo :initarg :repo :initform #p"/" :accessor repo) diff --git a/src/feeds.lisp b/src/feeds.lisp index 30692dd..d2306e2 100644 --- a/src/feeds.lisp +++ b/src/feeds.lisp @@ -15,20 +15,11 @@ (local-time:now)))) (local-time:format-rfc1123-timestring nil timestamp))) -(defun render-feeds () - "Render and write the feed for the site." - (let* ((bydate (by-date (hash-table-values *posts*))) - (posts (subseq bydate 0 (min (length bydate) 10))) - (content (loop for post in posts - collect (list :title (post-title post) - :url (post-url post) - :date (make-pubdate (post-date post)) - :tags (post-tags post) - :content (post-content post)))) - (tmpl-args (list :pubdate (make-pubdate) - :title (title *config*) - :siteroot (domain *config*) - :author (author *config*) - :posts content))) - (render-page "rss.xml" (funcall (theme-fn 'rss) tmpl-args) :raw t) - (render-page "feed.atom" (funcall (theme-fn 'atom) tmpl-args) :raw t))) +(defun render-feeds (feeds) + "Render and write the given FEEDS for the site." + (let* ((by-date (by-date (hash-table-values *posts*))) + (posts (subseq by-date 0 (min (length by-date) 10)))) + (render-page (make-instance 'index :path "rss.xml" :posts posts) :rss) + (render-page (make-instance 'index :path "feed.atom" :posts posts) :atom) + (dolist (feed feeds) + (render-page feed :rss)))) diff --git a/themes/atom.tmpl b/themes/atom.tmpl index 8f61a8e..ece85ec 100644 --- a/themes/atom.tmpl +++ b/themes/atom.tmpl @@ -4,23 +4,23 @@ {\n} - {$title} - - + {$config.title} + + {$pubdate} - {$author} + {$config.author} - {foreach $post in $posts} + {foreach $post in $content.posts} - + {$post.title} {$post.date} {$post.date} - {$author} - {$siteroot} + {$config.author} + {$config.domain} {$post.content |noAutoescape} diff --git a/themes/rss.tmpl b/themes/rss.tmpl index 6ed1dd2..e2ea660 100644 --- a/themes/rss.tmpl +++ b/themes/rss.tmpl @@ -4,19 +4,19 @@ {\n} - {$title} - {$siteroot} - + {$config.title} + {$config.domain} + en-us {$pubdate} - {foreach $post in $posts} + {foreach $post in $content.posts} {$post.title} - {$siteroot}/posts/{$post.url} + {$config.domain}/posts/{$post.slug}.html {$post.date} - {$author} - {$siteroot}/posts/{$post.url} + {$config.author} + {$config.domain}/posts/{$post.slug}.html {foreach $tag in $post.tags} {/foreach}