diff options
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 |