on master help sign in
Migrated examples to be up-to-date with master.
commit13b5c9241843b3baea01ad4dcb901745f3ad48b3 authorJasper Van der Jeugt <jaspervdj@gmail.com> dateMon 18 Jan 2010, 21:43 (17 years ago) parent31476dd
3 files changed+18−16
examples/rssblog/hakyll.hs+7−6 examples/simpleblog/hakyll.hs+6−5 examples/tagblog/hakyll.hs+5−5
examples/rssblog/hakyll.hs+7−6
@@ -1,6 +1,7 @@
11module Main where
22
3−import Text.Hakyll (hakyll)
3+import Control.Monad.Reader (liftIO)
4+import Text.Hakyll (hakyll, defaultHakyllConfiguration)
45import Text.Hakyll.Render (renderAndConcat, renderChain, css)
56import Text.Hakyll.File (getRecursiveContents, directory)
67import Text.Hakyll.Renderables (createPagePath, createCustomPage)
@@ -8,7 +9,7 @@ import Data.List (sort)
89import Control.Monad (mapM_, liftM)
910import Data.Either (Either(..))
1011
11−main = hakyll $ do
12+main = hakyll defaultHakyllConfiguration $ do
1213 -- Static directory.
1314 directory css "css"
1415
@@ -17,23 +18,23 @@ main = hakyll $ do
1718 let renderablePosts = map createPagePath postPaths
1819
1920 -- Render index, including recent posts.
20− let recentPosts = renderAndConcat "templates/postitem.html" $ take 3 renderablePosts
21+ let recentPosts = renderAndConcat ["templates/postitem.html"] $ take 3 renderablePosts
2122 renderChain ["index.html", "templates/default.html"] $
2223 createCustomPage "index.html" ("templates/postitem.html" : take 3 postPaths)
2324 [("title", Left "Home"), ("posts", Right recentPosts)]
2425
2526 -- Render all posts list.
26− let postItems = renderAndConcat "templates/postitem.html" $ renderablePosts
27+ let postItems = renderAndConcat ["templates/postitem.html"] $ renderablePosts
2728 renderChain ["posts.html", "templates/default.html"] $
2829 createCustomPage "posts.html" ("templates/postitem.html" : postPaths)
2930 [("title", Left "All posts"), ("posts", Right postItems)]
3031
3132 -- Render all posts.
32− putStrLn "Generating posts..."
33+ liftIO $ putStrLn "Generating posts..."
3334 mapM_ (renderChain ["templates/post.html", "templates/default.html"]) renderablePosts
3435
3536 -- Render rss feed
36− let recentRSSItems = renderAndConcat "templates/rssitem.xml" $ take 3 renderablePosts
37+ let recentRSSItems = renderAndConcat ["templates/rssitem.xml"] $ take 3 renderablePosts
3738 let rssPage = createCustomPage "rss.xml"
3839 ("templates/postitem.html" : take 3 postPaths)
3940 [("items", Right recentRSSItems)]
examples/simpleblog/hakyll.hs+6−5
@@ -1,15 +1,16 @@
11module Main where
22
3−import Text.Hakyll (hakyll)
3+import Text.Hakyll (hakyll, defaultHakyllConfiguration)
44import Text.Hakyll.Render
55import Text.Hakyll.Context
66import Text.Hakyll.File (getRecursiveContents, directory)
77import Text.Hakyll.Renderables (createPagePath, createCustomPage)
88import Data.List (sort)
99import Control.Monad (mapM_, liftM)
10+import Control.Monad.Reader (liftIO)
1011import Data.Either (Either(..))
1112
12−main = hakyll $ do
13+main = hakyll defaultHakyllConfiguration $ do
1314 -- Static directory.
1415 directory css "css"
1516
@@ -18,18 +19,18 @@ main = hakyll $ do
1819 let renderablePosts = map createPagePath postPaths
1920
2021 -- Render index, including recent posts.
21− let recentPosts = renderAndConcat "templates/postitem.html" $ take 3 renderablePosts
22+ let recentPosts = renderAndConcat ["templates/postitem.html"] $ take 3 renderablePosts
2223 renderChain ["index.html", "templates/default.html"] $
2324 createCustomPage "index.html" ("templates/postitem.html" : take 3 postPaths)
2425 [("title", Left "Home"), ("posts", Right recentPosts)]
2526
2627 -- Render all posts list.
27− let postItems = renderAndConcat "templates/postitem.html" $ renderablePosts
28+ let postItems = renderAndConcat ["templates/postitem.html"] $ renderablePosts
2829 renderChain ["posts.html", "templates/default.html"] $
2930 createCustomPage "posts.html" ("templates/postitem.html" : postPaths)
3031 [("title", Left "All posts"), ("posts", Right postItems)]
3132
3233 -- Render all posts.
33− putStrLn "Generating posts..."
34+ liftIO $ putStrLn "Generating posts..."
3435 mapM_ (renderChain ["templates/post.html", "templates/default.html"]) renderablePosts
3536
examples/tagblog/hakyll.hs+5−5
@@ -1,6 +1,6 @@
11module Main where
22
3−import Text.Hakyll (hakyll)
3+import Text.Hakyll (hakyll, defaultHakyllConfiguration)
44import Text.Hakyll.Render
55import Text.Hakyll.Tags (readTagMap, renderTagCloud, renderTagLinks)
66import Text.Hakyll.File (getRecursiveContents, directory, removeSpaces)
@@ -11,7 +11,7 @@ import Data.Map (toList)
1111import Control.Monad (mapM_, liftM)
1212import Data.Either (Either(..))
1313
14−main = hakyll $ do
14+main = hakyll defaultHakyllConfiguration $ do
1515 -- Static directory.
1616 directory css "css"
1717
@@ -31,7 +31,7 @@ main = hakyll $ do
3131
3232 -- Render index, including recent posts.
3333 let recentPosts = renderAndConcatWith postManipulation
34− "templates/postitem.html"
34+ ["templates/postitem.html"]
3535 (take 3 renderablePosts)
3636 renderChain ["index.html", "templates/default.html"] $
3737 createCustomPage "index.html" ("templates/postitem.html" : take 3 postPaths)
@@ -45,7 +45,7 @@ main = hakyll $ do
4545 ]) renderablePosts
4646
4747 -- Render rss feed
48− let recentRSSItems = renderAndConcat "templates/rssitem.xml" $ take 3 renderablePosts
48+ let recentRSSItems = renderAndConcat ["templates/rssitem.xml"] $ take 3 renderablePosts
4949 let rssPage = createCustomPage "rss.xml"
5050 ("templates/postitem.html" : take 3 postPaths)
5151 [("items", Right recentRSSItems)]
@@ -62,7 +62,7 @@ main = hakyll $ do
6262
6363 renderPostList url title posts = do
6464 let postItems = renderAndConcatWith postManipulation
65− "templates/postitem.html"
65+ ["templates/postitem.html"]
6666 (map createPagePath posts)
6767 customPage = createCustomPage url
6868 ("templates/postitem.html" : posts)