diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2013-02-24 10:50:38 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2013-02-24 10:55:11 +0100 |
commit | b91c8be54b14a84aa47b5033a9966653df7f84ca (patch) | |
tree | 795341847c1554b578604dca3be361dd47529318 /data/example | |
parent | 9b603587de20d42d95e6affc2bce85447de6f58e (diff) | |
download | hakyll-b91c8be54b14a84aa47b5033a9966653df7f84ca.tar.gz |
Update example & tutorials with new recentFirst
Diffstat (limited to 'data/example')
-rw-r--r-- | data/example/site.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/data/example/site.hs b/data/example/site.hs index 2488cc8..9e103bf 100644 --- a/data/example/site.hs +++ b/data/example/site.hs @@ -1,7 +1,6 @@ -------------------------------------------------------------------------------- {-# LANGUAGE OverloadedStrings #-} -import Control.Applicative ((<$>)) -import Data.Monoid (mappend) +import Data.Monoid (mappend) import Hakyll @@ -46,7 +45,8 @@ main = hakyll $ do match "index.html" $ do route idRoute compile $ do - let indexCtx = field "posts" $ \_ -> postList (take 3 . recentFirst) + let indexCtx = field "posts" $ \_ -> + postList $ fmap (take 3) . recentFirst getResourceBody >>= applyAsTemplate indexCtx @@ -64,9 +64,9 @@ postCtx = -------------------------------------------------------------------------------- -postList :: ([Item String] -> [Item String]) -> Compiler String +postList :: ([Item String] -> Compiler [Item String]) -> Compiler String postList sortFilter = do - posts <- sortFilter <$> loadAll "posts/*" + posts <- sortFilter =<< loadAll "posts/*" itemTpl <- loadBody "templates/post-item.html" list <- applyTemplateList itemTpl postCtx posts return list |