summaryrefslogtreecommitdiff
path: root/examples/simpleblog/hakyll.hs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/simpleblog/hakyll.hs')
-rw-r--r--examples/simpleblog/hakyll.hs10
1 files changed, 3 insertions, 7 deletions
diff --git a/examples/simpleblog/hakyll.hs b/examples/simpleblog/hakyll.hs
index bdcb3fe..8b53215 100644
--- a/examples/simpleblog/hakyll.hs
+++ b/examples/simpleblog/hakyll.hs
@@ -4,7 +4,7 @@ import Text.Hakyll (hakyll)
import Text.Hakyll.Render
import Text.Hakyll.Context
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 Control.Monad.Reader (liftIO)
@@ -19,16 +19,12 @@ 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)]
+ createListing "index.html" "templates/postitem.html" (take 3 renderablePosts) [("title", "Home")]
-- 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)]
+ createListing "posts.html" "templates/postitem.html" renderablePosts [("title", "All posts")]
-- Render all posts.
liftIO $ putStrLn "Generating posts..."