aboutsummaryrefslogtreecommitdiff
path: root/Cooking.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Cooking.hs')
-rw-r--r--Cooking.hs29
1 files changed, 29 insertions, 0 deletions
diff --git a/Cooking.hs b/Cooking.hs
new file mode 100644
index 0000000..a5be5a1
--- /dev/null
+++ b/Cooking.hs
@@ -0,0 +1,29 @@
+{-# LANGUAGE OverloadedStrings #-}
+
+import Data.Monoid (mappend)
+import Hakyll
+
+main :: IO ()
+main = hakyll $ do
+ match "design/*.hs" $ do
+ route $ setExtension "css"
+ compile $ getResourceString >>= withItemBody (unixFilter "runghc" [])
+
+ match "recipes/*" $ do
+ route $ setExtension "html"
+ compile $ pandocCompiler
+ >>= loadAndApplyTemplate "templates/main.html" defaultContext
+ >>= relativizeUrls
+
+ match "index.html" $ do
+ route idRoute
+ let context =
+ listField "recipes" defaultContext (loadAll "recipes/*") `mappend`
+ defaultContext
+ compile $
+ getResourceBody
+ >>= applyAsTemplate context
+ >>= loadAndApplyTemplate "templates/main.html" context
+ >>= relativizeUrls
+
+ match "templates/*" $ compile templateBodyCompiler