summaryrefslogtreecommitdiff
path: root/examples/rssblog
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2010-01-29 12:19:53 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2010-01-29 12:19:53 +0100
commit7128cc9b5f77eb40bfb0b04d74ddfe2e10a171fe (patch)
tree7abe96cb7a32d0633eb2024114c750b58c88e8b9 /examples/rssblog
parentd205f96825d73e0ad7efc97a321333dacfbf9e0c (diff)
downloadhakyll-7128cc9b5f77eb40bfb0b04d74ddfe2e10a171fe.tar.gz
Updated simpleblog, rssblog and tagblog examples to trunk.
Diffstat (limited to 'examples/rssblog')
-rw-r--r--examples/rssblog/hakyll.hs21
-rw-r--r--examples/rssblog/index.html2
-rw-r--r--examples/rssblog/posts.html2
-rw-r--r--examples/rssblog/templates/rss.xml2
4 files changed, 10 insertions, 17 deletions
diff --git a/examples/rssblog/hakyll.hs b/examples/rssblog/hakyll.hs
index 8d403b4..50970f8 100644
--- a/examples/rssblog/hakyll.hs
+++ b/examples/rssblog/hakyll.hs
@@ -4,7 +4,7 @@ import Control.Monad.Reader (liftIO)
import Text.Hakyll (hakyll)
import Text.Hakyll.Render (renderAndConcat, renderChain, css)
import Text.Hakyll.File (getRecursiveContents, directory)
-import Text.Hakyll.Renderables (createPagePath, createCustomPage)
+import Text.Hakyll.Renderables (createPagePath, createCustomPage, createListing)
import Data.List (sort)
import Control.Monad (mapM_, liftM)
import Data.Either (Either(..))
@@ -18,24 +18,17 @@ main = hakyll $ do
let renderablePosts = map createPagePath postPaths
-- Render index, including recent posts.
- let recentPosts = renderAndConcat ["templates/postitem.html"] $ take 3 renderablePosts
- renderChain ["index.html", "templates/default.html"] $
- createCustomPage "index.html" ("templates/postitem.html" : take 3 postPaths)
- [("title", Left "Home"), ("posts", Right recentPosts)]
+ let index = createListing "index.html" "templates/postitem.html" (take 3 renderablePosts) [("title", "Home")]
+ renderChain ["index.html", "templates/default.html"] index
-- Render all posts list.
- let postItems = renderAndConcat ["templates/postitem.html"] $ renderablePosts
- renderChain ["posts.html", "templates/default.html"] $
- createCustomPage "posts.html" ("templates/postitem.html" : postPaths)
- [("title", Left "All posts"), ("posts", Right postItems)]
+ let posts = createListing "posts.html" "templates/postitem.html" renderablePosts [("title", "All posts")]
+ renderChain ["posts.html", "templates/default.html"] posts
-- Render all posts.
liftIO $ putStrLn "Generating posts..."
mapM_ (renderChain ["templates/post.html", "templates/default.html"]) renderablePosts
-- Render rss feed
- let recentRSSItems = renderAndConcat ["templates/rssitem.xml"] $ take 3 renderablePosts
- let rssPage = createCustomPage "rss.xml"
- ("templates/postitem.html" : take 3 postPaths)
- [("items", Right recentRSSItems)]
- renderChain ["templates/rss.xml"] rssPage
+ let rss = createListing "rss.xml" "templates/rssitem.xml" (take 3 renderablePosts) []
+ renderChain ["templates/rss.xml"] rss
diff --git a/examples/rssblog/index.html b/examples/rssblog/index.html
index 201cc18..88cc0a2 100644
--- a/examples/rssblog/index.html
+++ b/examples/rssblog/index.html
@@ -1,7 +1,7 @@
<div id="posts">
<h1>Recent posts</h1>
<ul>
- $posts
+ $body
</ul>
<a href="$root/posts.html">All posts...</a>
</div>
diff --git a/examples/rssblog/posts.html b/examples/rssblog/posts.html
index bc1741b..7db1a59 100644
--- a/examples/rssblog/posts.html
+++ b/examples/rssblog/posts.html
@@ -1,4 +1,4 @@
<h1>All posts</h1>
<ul>
- $posts
+ $body
</ul>
diff --git a/examples/rssblog/templates/rss.xml b/examples/rssblog/templates/rss.xml
index be918af..1217b4e 100644
--- a/examples/rssblog/templates/rss.xml
+++ b/examples/rssblog/templates/rss.xml
@@ -4,6 +4,6 @@
<title>The SimpleBlog</title>
<link>http://example.com</link>
<description>Simple blog in hakyll</description>
- $items
+ $body
</channel>
</rss>