diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-12-13 22:25:28 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-12-13 22:25:28 +0100 |
commit | cfac1bbca6e5950d8abdc8329e84de4794e08677 (patch) | |
tree | b0fc802c209dd1fd8ec59c0c490c115b9bd59651 /data | |
parent | 089670629bc0f84c74fef520772caec842d2a549 (diff) | |
download | hakyll-cfac1bbca6e5950d8abdc8329e84de4794e08677.tar.gz |
Rename require to load, thanks @ddfreyne
Diffstat (limited to 'data')
-rw-r--r-- | data/example/site.hs | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/data/example/site.hs b/data/example/site.hs index 5f064e8..9c24b34 100644 --- a/data/example/site.hs +++ b/data/example/site.hs @@ -18,9 +18,17 @@ main = hakyll $ do match (fromList ["about.rst", "contact.markdown"]) $ do route $ setExtension "html" + compile $ do + + defaultTpl <- loadBody "templates/default.html" + pageCompiler + >>= applyTemplate defaultTpl defaultContext + >>= relativizeUrls + {- compile $ pageCompiler - >>= requireApplyTemplate "templates/default.html" defaultContext + >>= loadAndApplyTemplate "templates/default.html" defaultContext >>= relativizeUrls + -} match "posts/*" $ do route $ setExtension "html" @@ -28,8 +36,8 @@ main = hakyll $ do post <- pageCompiler saveSnapshot "content" post return post - >>= requireApplyTemplate "templates/post.html" postCtx - >>= requireApplyTemplate "templates/default.html" postCtx + >>= loadAndApplyTemplate "templates/post.html" postCtx + >>= loadAndApplyTemplate "templates/default.html" postCtx >>= relativizeUrls match "archive.html" $ do @@ -41,8 +49,8 @@ main = hakyll $ do defaultContext makeItem "" - >>= requireApplyTemplate "templates/archive.html" archiveCtx - >>= requireApplyTemplate "templates/default.html" archiveCtx + >>= loadAndApplyTemplate "templates/archive.html" archiveCtx + >>= loadAndApplyTemplate "templates/default.html" archiveCtx >>= relativizeUrls @@ -52,8 +60,8 @@ main = hakyll $ do let indexCtx = field "posts" $ \_ -> postList (take 3 . recentFirst) getResourceBody - >>= applySelf indexCtx - >>= requireApplyTemplate "templates/default.html" postCtx + >>= applyAsTemplate indexCtx + >>= loadAndApplyTemplate "templates/default.html" postCtx >>= relativizeUrls match "templates/*" $ compile templateCompiler @@ -69,7 +77,7 @@ postCtx = -------------------------------------------------------------------------------- postList :: ([Item String] -> [Item String]) -> Compiler String postList preprocess = do - posts <- preprocess <$> requireAll "posts/*" - itemTpl <- requireBody "templates/post-item.html" + posts <- preprocess <$> loadAll "posts/*" + itemTpl <- loadBody "templates/post-item.html" list <- applyTemplateList itemTpl postCtx posts return list |