diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-12-05 16:54:57 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2012-12-05 16:54:57 +0100 |
commit | 5ee1339ad4255185f41187e93a022eb143b138f8 (patch) | |
tree | d15d7d6c8c7a817dd6a0a3dedac18be387ecffaf /web/hakyll.hs | |
parent | 95e1fcf0a2a5a51e486311079d7aa2bb2035c8e6 (diff) | |
download | hakyll-5ee1339ad4255185f41187e93a022eb143b138f8.tar.gz |
Port hakyll website to hakyll 4
Diffstat (limited to 'web/hakyll.hs')
-rw-r--r-- | web/hakyll.hs | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/web/hakyll.hs b/web/hakyll.hs index 6dcb623..93a7216 100644 --- a/web/hakyll.hs +++ b/web/hakyll.hs @@ -1,10 +1,12 @@ +-------------------------------------------------------------------------------- {-# LANGUAGE OverloadedStrings #-} -import Hakyll -import Control.Monad (forM_) -import Control.Arrow ((>>>), arr) -import Data.Monoid (mempty) -import Text.Pandoc +import Control.Monad (forM_) +import Data.Monoid (mappend) +import Hakyll +import Text.Pandoc + +-------------------------------------------------------------------------------- main :: IO () main = hakyllWith config $ do match "css/*" $ do @@ -17,35 +19,38 @@ main = hakyllWith config $ do compile copyFileCompiler -- Pages - forM_ pages $ \p -> match p $ do + match "*.markdown" $ do route $ setExtension "html" compile $ pageCompiler - >>> requireA "sidebar.markdown" (setFieldA "sidebar" $ arr pageBody) - >>> applyTemplateCompiler "templates/default.html" - >>> relativizeUrlsCompiler + >>= requireApplyTemplate "templates/default.html" defaultContext + >>= relativizeUrls -- Tutorials match "tutorials/*" $ do route $ setExtension "html" compile $ pageCompilerWith defaultHakyllParserState withToc - >>> requireA "sidebar.markdown" (setFieldA "sidebar" $ arr pageBody) - >>> applyTemplateCompiler "templates/tutorial.html" - >>> applyTemplateCompiler "templates/default.html" - >>> relativizeUrlsCompiler + >>= requireApplyTemplate "templates/tutorial.html" defaultContext + >>= requireApplyTemplate "templates/default.html" defaultContext + >>= relativizeUrls -- Tutorial list - match "tutorials.html" $ route idRoute - create "tutorials.html" $ constA mempty - >>> arr (setField "title" "Tutorials") - >>> setFieldPageList chronological - "templates/tutorial-item.html" "tutorials" "tutorials/*" - >>> requireA "sidebar.markdown" (setFieldA "sidebar" $ arr pageBody) - >>> applyTemplateCompiler "templates/tutorials.html" - >>> applyTemplateCompiler "templates/default.html" - >>> relativizeUrlsCompiler + match "tutorials.html" $ do + route idRoute + compile $ do + tutorials <- requireAll "tutorials/*" + itemTpl <- requireBody "templates/tutorial-item.html" + list <- applyTemplateList itemTpl defaultContext $ + chronological tutorials + + let tutorialsCtx = + constField "title" "Tutorials" `mappend` + constField "tutorials" list `mappend` + defaultContext - -- Sidebar - match "sidebar.markdown" $ compile pageCompiler + makeItem "" + >>= requireApplyTemplate "templates/tutorials.html" tutorialsCtx + >>= requireApplyTemplate "templates/default.html" tutorialsCtx + >>= relativizeUrls -- Templates match "templates/*" $ compile templateCompiler @@ -56,16 +61,11 @@ main = hakyllWith config $ do , writerStandalone = True } - pages = [ "about.markdown" - , "changelog.markdown" - , "examples.markdown" - , "index.markdown" - , "philosophy.markdown" - , "reference.markdown" - ] -config :: HakyllConfiguration -config = defaultHakyllConfiguration - { deployCommand = "rsync --checksum -ave 'ssh -p 2222' \ +-------------------------------------------------------------------------------- +config :: Configuration +config = defaultConfiguration + { verbosity = Debug + , deployCommand = "rsync --checksum -ave 'ssh -p 2222' \ \_site/* jaspervdj@jaspervdj.be:jaspervdj.be/hakyll" } |