diff options
Diffstat (limited to 'examples/simpleblog')
-rw-r--r-- | examples/simpleblog/hakyll.hs | 10 | ||||
-rw-r--r-- | examples/simpleblog/index.html | 2 | ||||
-rw-r--r-- | examples/simpleblog/posts.html | 2 |
3 files changed, 5 insertions, 9 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..." diff --git a/examples/simpleblog/index.html b/examples/simpleblog/index.html index 201cc18..88cc0a2 100644 --- a/examples/simpleblog/index.html +++ b/examples/simpleblog/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/simpleblog/posts.html b/examples/simpleblog/posts.html index bc1741b..7db1a59 100644 --- a/examples/simpleblog/posts.html +++ b/examples/simpleblog/posts.html @@ -1,4 +1,4 @@ <h1>All posts</h1> <ul> - $posts + $body </ul> |