Overhaul RENDER-FEEDS and associated templates.
This commit is contained in:
parent
f438f0eb89
commit
2b357db86f
5 changed files with 25 additions and 33 deletions
|
@ -35,7 +35,7 @@ Additional args to render CONTENT can be passed via RENDER-ARGS."
|
||||||
(run-program "cp -R ~a ." dir)))
|
(run-program "cp -R ~a ." dir)))
|
||||||
(render-posts)
|
(render-posts)
|
||||||
(render-indices)
|
(render-indices)
|
||||||
(render-feeds)))
|
(render-feeds (feeds *config*))))
|
||||||
|
|
||||||
(defgeneric deploy (staging)
|
(defgeneric deploy (staging)
|
||||||
(:documentation "Deploy the STAGING dir, updating the .prev and .curr symlinks.")
|
(:documentation "Deploy the STAGING dir, updating the .prev and .curr symlinks.")
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
((author :initarg :author :initform "" :accessor author)
|
((author :initarg :author :initform "" :accessor author)
|
||||||
(deploy :initarg :deploy :initform nil :accessor deploy)
|
(deploy :initarg :deploy :initform nil :accessor deploy)
|
||||||
(domain :initarg :domain :initform "" :accessor domain)
|
(domain :initarg :domain :initform "" :accessor domain)
|
||||||
|
(feeds :initarg :feeds :initform nil :accessor feeds)
|
||||||
(license :initarg :license :initform "CC-BY-SA" :accessor license)
|
(license :initarg :license :initform "CC-BY-SA" :accessor license)
|
||||||
(plugins :initarg :plugins :initform '() :accessor plugins)
|
(plugins :initarg :plugins :initform '() :accessor plugins)
|
||||||
(repo :initarg :repo :initform #p"/" :accessor repo)
|
(repo :initarg :repo :initform #p"/" :accessor repo)
|
||||||
|
|
|
@ -15,20 +15,11 @@
|
||||||
(local-time:now))))
|
(local-time:now))))
|
||||||
(local-time:format-rfc1123-timestring nil timestamp)))
|
(local-time:format-rfc1123-timestring nil timestamp)))
|
||||||
|
|
||||||
(defun render-feeds ()
|
(defun render-feeds (feeds)
|
||||||
"Render and write the feed for the site."
|
"Render and write the given FEEDS for the site."
|
||||||
(let* ((bydate (by-date (hash-table-values *posts*)))
|
(let* ((by-date (by-date (hash-table-values *posts*)))
|
||||||
(posts (subseq bydate 0 (min (length bydate) 10)))
|
(posts (subseq by-date 0 (min (length by-date) 10))))
|
||||||
(content (loop for post in posts
|
(render-page (make-instance 'index :path "rss.xml" :posts posts) :rss)
|
||||||
collect (list :title (post-title post)
|
(render-page (make-instance 'index :path "feed.atom" :posts posts) :atom)
|
||||||
:url (post-url post)
|
(dolist (feed feeds)
|
||||||
:date (make-pubdate (post-date post))
|
(render-page feed :rss))))
|
||||||
: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)))
|
|
||||||
|
|
|
@ -4,23 +4,23 @@
|
||||||
<?xml version="1.0"?>{\n}
|
<?xml version="1.0"?>{\n}
|
||||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||||
|
|
||||||
<title>{$title}</title>
|
<title>{$config.title}</title>
|
||||||
<link href="{$siteroot}"/>
|
<link href="{$config.domain}"/>
|
||||||
<link type="application/atom+xml" rel="self" href="{$siteroot}/atom.xml"/>
|
<link type="application/atom+xml" rel="self" href="{$config.domain}/atom.xml"/>
|
||||||
<updated>{$pubdate}</updated>
|
<updated>{$pubdate}</updated>
|
||||||
<author>
|
<author>
|
||||||
<name>{$author}</name>
|
<name>{$config.author}</name>
|
||||||
</author>
|
</author>
|
||||||
|
|
||||||
{foreach $post in $posts}
|
{foreach $post in $content.posts}
|
||||||
<entry>
|
<entry>
|
||||||
<link type="text/html" rel="alternate" href="{$post.url}"/>
|
<link type="text/html" rel="alternate" href="{$config.domain}/posts/{$post.slug}.html"/>
|
||||||
<title>{$post.title}</title>
|
<title>{$post.title}</title>
|
||||||
<published>{$post.date}</published>
|
<published>{$post.date}</published>
|
||||||
<updated>{$post.date}</updated>
|
<updated>{$post.date}</updated>
|
||||||
<author>
|
<author>
|
||||||
<name>{$author}</name>
|
<name>{$config.author}</name>
|
||||||
<uri>{$siteroot}</uri>
|
<uri>{$config.domain}</uri>
|
||||||
</author>
|
</author>
|
||||||
<content type="html">{$post.content |noAutoescape}</content>
|
<content type="html">{$post.content |noAutoescape}</content>
|
||||||
</entry>
|
</entry>
|
||||||
|
|
|
@ -4,19 +4,19 @@
|
||||||
<?xml version="1.0"?>{\n}
|
<?xml version="1.0"?>{\n}
|
||||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||||
<channel>
|
<channel>
|
||||||
<title>{$title}</title>
|
<title>{$config.title}</title>
|
||||||
<link>{$siteroot}</link>
|
<link>{$config.domain}</link>
|
||||||
<atom:link href="{$siteroot}/rss.xml" rel="self" type="application/rss+xml" />
|
<atom:link href="{$config.domain}/rss.xml" rel="self" type="application/rss+xml" />
|
||||||
<language>en-us</language>
|
<language>en-us</language>
|
||||||
<pubDate>{$pubdate}</pubDate>
|
<pubDate>{$pubdate}</pubDate>
|
||||||
|
|
||||||
{foreach $post in $posts}
|
{foreach $post in $content.posts}
|
||||||
<item>
|
<item>
|
||||||
<title>{$post.title}</title>
|
<title>{$post.title}</title>
|
||||||
<link>{$siteroot}/posts/{$post.url}</link>
|
<link>{$config.domain}/posts/{$post.slug}.html</link>
|
||||||
<pubDate>{$post.date}</pubDate>
|
<pubDate>{$post.date}</pubDate>
|
||||||
<author>{$author}</author>
|
<author>{$config.author}</author>
|
||||||
<guid isPermaLink="true">{$siteroot}/posts/{$post.url}</guid>
|
<guid isPermaLink="true">{$config.domain}/posts/{$post.slug}.html</guid>
|
||||||
{foreach $tag in $post.tags}
|
{foreach $tag in $post.tags}
|
||||||
<category><![CDATA[ {$tag} ]]></category>
|
<category><![CDATA[ {$tag} ]]></category>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
|
|
Loading…
Add table
Reference in a new issue