Add ATOM feed support.
This commit is contained in:
parent
af0ee8c411
commit
d3dc6f0c5c
4 changed files with 42 additions and 10 deletions
|
@ -34,7 +34,7 @@ If RAW is non-nil, write the content without wrapping it in the base template."
|
|||
(run-program "cp -R ~a ." dir)))
|
||||
(render-posts)
|
||||
(render-indices)
|
||||
(render-feed)))
|
||||
(render-feeds)))
|
||||
|
||||
(defgeneric deploy (staging)
|
||||
(:documentation "Deploy the STAGING dir, updating the .prev and .curr symlinks.")
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
(local-time:now))))
|
||||
(local-time:format-rfc1123-timestring nil timestamp)))
|
||||
|
||||
(defun render-feed ()
|
||||
(defun render-feeds ()
|
||||
"Render and write the feed for the site."
|
||||
(let* ((posts (subseq (by-date (hash-table-values *posts*)) 0 10))
|
||||
(content (loop for post in posts
|
||||
|
@ -23,11 +23,11 @@
|
|||
:url (post-url post)
|
||||
:date (make-pubdate (post-date post))
|
||||
:tags (post-tags post)
|
||||
:content (post-content post)))))
|
||||
(render-page "rss.xml"
|
||||
(funcall (theme-fn 'rss)
|
||||
(list :pubdate (make-pubdate)
|
||||
:title (title *config*)
|
||||
:siteroot (domain *config*)
|
||||
:author (author *config*)
|
||||
:posts content)) :raw t)))
|
||||
: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)))
|
||||
|
|
31
themes/hyde/atom.tmpl
Normal file
31
themes/hyde/atom.tmpl
Normal file
|
@ -0,0 +1,31 @@
|
|||
{namespace coleslaw.theme.hyde}
|
||||
|
||||
{template atom}
|
||||
<?xml version="1.0"?>{\n}
|
||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
|
||||
<title>{$title}</title>
|
||||
<link href="{$siteroot}"/>
|
||||
<link type="application/atom+xml" rel="self" href="{$siteroot}/atom.xml"/>
|
||||
<updated>{$pubdate}</updated>
|
||||
<id>{$siteroot}@{$pubdate}</id>
|
||||
<author>
|
||||
<name>{$author}</name>
|
||||
</author>
|
||||
|
||||
{foreach $post in $posts}
|
||||
<entry>
|
||||
<link type="text/html" rel="alternate" href="$post.url"/>
|
||||
<title>{$post.title}</title>
|
||||
<published>{$post.date}</published>
|
||||
<updated>{$post.date}</updated>
|
||||
<author>
|
||||
<name>{$author}</name>
|
||||
<uri>{$siteroot}</uri>
|
||||
</author>
|
||||
<content type="html">{$post.content}</content>
|
||||
</entry>
|
||||
{/foreach}
|
||||
|
||||
</feed>
|
||||
{/template}
|
|
@ -10,6 +10,7 @@
|
|||
<link href="http://fonts.googleapis.com/css?family=Inconsolata" rel="stylesheet" type="text/css" />
|
||||
<link href= "{$siteroot}/css/style.css" rel="stylesheet" type="text/css" />
|
||||
<link rel="alternate" href="{$siteroot}/feed.atom" type="application/atom+xml" />
|
||||
<link rel="alternate" href="{$siteroot}/rss.xml" type="application/rss+xml" />
|
||||
{if $headInject} {$headInject |noAutoescape} {/if}
|
||||
</head>
|
||||
<body>
|
||||
|
|
Loading…
Add table
Reference in a new issue