pass pattern to postList
authorrekado <rekado@elephly.net>
Sun, 27 Oct 2013 01:40:18 +0000 (09:40 +0800)
committerrekado <rekado@elephly.net>
Sun, 27 Oct 2013 01:40:18 +0000 (09:40 +0800)
site.hs

diff --git a/site.hs b/site.hs
index 3fd4a94060f6c67dc72478af5d2d6d8514a08ecb..a25981662126c61c1ebb3fe87a69b4624199f799 100644 (file)
--- a/site.hs
+++ b/site.hs
@@ -80,7 +80,7 @@ main = hakyllWith config $ do
       compile $ do
         let archiveCtx =
               constField "title" title `mappend`
-              field "posts" (\_ -> postList recentFirst) `mappend`
+              field "posts" (\_ -> postList "posts/*.markdown" recentFirst) `mappend`
               defaultContext
 
         makeItem ""
@@ -132,9 +132,9 @@ postFeed renderer = do
     renderer myFeedConfiguration feedCtx posts
 
 --------------------------------------------------------------------------------
-postList :: ([Item String] -> Compiler [Item String]) -> Compiler String
-postList sortFilter = do
-  posts   <- sortFilter =<< loadAll ("posts/*.markdown" .&&. hasNoVersion)
+postList :: Pattern -> ([Item String] -> Compiler [Item String]) -> Compiler String
+postList pattern sortFilter = do
+  posts   <- sortFilter =<< loadAll (pattern .&&. hasNoVersion)
   itemTpl <- loadBody "templates/post-item.html"
   list    <- applyTemplateList itemTpl postCtx posts
   return list