diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-12-07 11:36:20 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-12-07 11:36:20 +0100 |
commit | 251e1126c38eafca2890c3bfd268956624cf3397 (patch) | |
tree | 32b67ab1d49b9549809db3fae7946fbb0e3e6336 /data/example/site.hs | |
parent | 7d20671bb3ff7b970ff7556ed18fd5714ab962da (diff) | |
download | hakyll-251e1126c38eafca2890c3bfd268956624cf3397.tar.gz |
Bit of work on example site
Diffstat (limited to 'data/example/site.hs')
-rw-r--r-- | data/example/site.hs | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/data/example/site.hs b/data/example/site.hs index df53095..ccf8ff8 100644 --- a/data/example/site.hs +++ b/data/example/site.hs @@ -1,6 +1,8 @@ -------------------------------------------------------------------------------- {-# LANGUAGE OverloadedStrings #-} import Hakyll +import Data.List (sort) +import Control.Applicative ((<$>)) -------------------------------------------------------------------------------- @@ -14,10 +16,28 @@ main = hakyll $ do route idRoute compile compressCssCompiler - match (fromList ["about.rst", "index.markdown", "code.lhs"]) $ do + match (fromList ["about.rst", "code.lhs"]) $ do route $ setExtension "html" compile $ pageCompiler >>= requireApplyTemplate "templates/default.html" defaultContext >>= relativizeUrls + match "posts/*" $ do + route $ setExtension "html" + compile $ do + post <- pageCompiler + saveSnapshot "content" post + return post + >>= requireApplyTemplate "templates/default.html" defaultContext + >>= relativizeUrls + + match "index.html" $ do + route idRoute + compile $ do + posts <- sort <$> getMatches "posts/*" + post <- requireSnapshot (head posts) "content" + return post + >>= requireApplyTemplate "templates/default.html" defaultContext + >>= relativizeUrls + match "templates/*" $ compile templateCompiler |