diff options
-rw-r--r-- | site.hs | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -25,6 +25,8 @@ myFeedConfiguration = FeedConfiguration -------------------------------------------------------------------------------- main :: IO () main = hakyllWith config $ do + tags <- buildTags "posts/*.markdown" (fromCapture "tags/*.html") + match "css/*" $ do route idRoute compile compressCssCompiler @@ -98,6 +100,21 @@ main = hakyllWith config $ do mostRecent <- fmap head . recentFirst =<< loadAllSnapshots "posts/*.markdown" "non-relative" makeItem (itemBody mostRecent) >>= relativizeUrls + + tagsRules tags $ \tag pattern -> do + let title = "Posts tagged “" ++ tag ++ "”" + + route idRoute + compile $ do + let ctx = constField "title" title `mappend` + field "posts" (\_ -> postList pattern recentFirst) `mappend` + defaultContext + + makeItem "" + >>= loadAndApplyTemplate "templates/archive.html" ctx + >>= loadAndApplyTemplate "templates/default.html" ctx + >>= relativizeUrls + match "templates/*" $ compile templateCompiler |