diff options
| author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2010-03-12 16:46:08 +0100 |
|---|---|---|
| committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2010-03-12 16:46:08 +0100 |
| commit | e7918c39f8378cc5d5df390a0f6a9f60dd3ba1a3 (patch) | |
| tree | a1229f4e202beb5badf26a1899648b4418c4c83e /examples/simpleblog | |
| parent | dabfc43e08bc2e93d6ba07f6545ea31a5441e82f (diff) | |
| download | hakyll-e7918c39f8378cc5d5df390a0f6a9f60dd3ba1a3.tar.gz | |
Wrote fourth part of the tutorials.
Diffstat (limited to 'examples/simpleblog')
| -rw-r--r-- | examples/simpleblog/hakyll.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/simpleblog/hakyll.hs b/examples/simpleblog/hakyll.hs index 638861a..75173f8 100644 --- a/examples/simpleblog/hakyll.hs +++ b/examples/simpleblog/hakyll.hs @@ -4,29 +4,29 @@ import Text.Hakyll (hakyll) import Text.Hakyll.Render import Text.Hakyll.Context import Text.Hakyll.File (getRecursiveContents, directory) -import Text.Hakyll.Renderables (createPagePath, createCustomPage, createListing) +import Text.Hakyll.CreateContext (createPage, createCustomPage, createListing) import Data.List (sort) import Control.Monad (mapM_, liftM) import Control.Monad.Reader (liftIO) import Data.Either (Either(..)) -main = hakyll $ do +main = hakyll "http://example.com" $ do -- Static directory. directory css "css" -- Find all post paths. postPaths <- liftM (reverse . sort) $ getRecursiveContents "posts" - let renderablePosts = map createPagePath postPaths + let postPages = map createPage postPaths -- Render index, including recent posts. - let index = createListing "index.html" "templates/postitem.html" (take 3 renderablePosts) [("title", "Home")] + let index = createListing "index.html" ["templates/postitem.html"] (take 3 postPages) [("title", Left "Home")] renderChain ["index.html", "templates/default.html"] index -- Render all posts list. - let posts = createListing "posts.html" "templates/postitem.html" renderablePosts [("title", "All posts")] + let posts = createListing "posts.html" ["templates/postitem.html"] postPages [("title", Left "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 + mapM_ (renderChain ["templates/post.html", "templates/default.html"]) postPages |
