Created
February 10, 2013 20:22
-
-
Save nagisa/4750919 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
entryListing :: Context a -> [Item a] -> Compiler String | |
entryListing ctx entry = do | |
entryItemTpl <- loadBody "templates/entry-item.html" | |
applyTemplateList entryItemTpl ctx entry | |
makePostList ctx = makeItem "" | |
>>= loadAndApplyTemplate "templates/entries.html" ctx | |
>>= loadAndApplyTemplate "templates/base.html" ctx | |
>>= relativizeUrls | |
main :: IO () | |
main = hakyll $ do | |
create ["entries.html"] $ do | |
route idRoute | |
compile $ do | |
items <- loadAll "entries/*" | |
let itemsList = entryListing (entryCtx tags) $ recentFirst items | |
let entriesCtx = mconcat [ constField "title" "Entries" | |
, field "entrylist" $ \_ -> itemsList | |
, defaultContext | |
] | |
makePostList entriesCtx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment