summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--web/hakyll.hs68
-rw-r--r--web/sidebar.markdown8
-rw-r--r--web/templates/default.html9
3 files changed, 42 insertions, 43 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"
}
diff --git a/web/sidebar.markdown b/web/sidebar.markdown
deleted file mode 100644
index 5eb62ca..0000000
--- a/web/sidebar.markdown
+++ /dev/null
@@ -1,8 +0,0 @@
-[home](/index.html)
-[philosophy](/philosophy.html)
-[about](/about.html)
-[faq](/tutorials/faq.html)
-[tutorials](/tutorials.html)
-[examples](/examples.html)
-[reference](/reference.html)
-[changelog](/changelog.html)
diff --git a/web/templates/default.html b/web/templates/default.html
index 57a5a52..53add69 100644
--- a/web/templates/default.html
+++ b/web/templates/default.html
@@ -23,7 +23,14 @@
<!-- Sidebar. -->
<div id="sidebar">
<h1>Navigation</h1>
- $sidebar$
+ <a href="/index.html">home</a>
+ <a href="/tutorials.html">tutorials</a>
+ <a href="/reference.html">reference</a>
+ <a href="/philosophy.html">philosophy</a>
+ <a href="/about.html">about</a>
+ <a href="/tutorials/faq.html">faq</a>
+ <a href="/examples.html">examples</a>
+ <a href="/changelog.html">changelog</a></p>
<!-- Flattr button -->
<h1>Donate</h1>