diff options
-rw-r--r-- | examples/hakyll/hakyll.hs | 25 | ||||
-rw-r--r-- | examples/hakyll/templates/tutorialitem.html | 3 | ||||
-rw-r--r-- | examples/hakyll/templates/tutorials.html | 7 | ||||
-rw-r--r-- | examples/hakyll/tutorial1.markdown | 1 | ||||
-rw-r--r-- | examples/hakyll/tutorial2.markdown | 1 | ||||
-rw-r--r-- | examples/hakyll/tutorial3.markdown | 1 | ||||
-rw-r--r-- | examples/hakyll/tutorials.markdown | 12 |
7 files changed, 30 insertions, 20 deletions
diff --git a/examples/hakyll/hakyll.hs b/examples/hakyll/hakyll.hs index 66febbe..3ae68e4 100644 --- a/examples/hakyll/hakyll.hs +++ b/examples/hakyll/hakyll.hs @@ -3,19 +3,28 @@ import Text.Hakyll.Render import Text.Hakyll.Renderables import Text.Hakyll.File -import Control.Monad(mapM_) +import Control.Monad (mapM_, liftM) +import Data.List (sort) + +import Text.Regex.Posix main = hakyll $ do directory css "css" directory static "images" directory static "examples" - mapM_ render' [ "about.markdown" - , "index.markdown" - , "tutorials.markdown" - , "tutorial1.markdown" - , "tutorial2.markdown" - , "tutorial3.markdown" - ] + tutorials <- liftM (sort . filter (=~ "tutorial[0-9]*.markdown")) $ getRecursiveContents "." + let tutorialList = renderAndConcat "templates/tutorialitem.html" + (map createPagePath tutorials) + tutorialPage = createCustomPage "tutorials.html" + ("templates/tutorialitem.html" : tutorials) + [ ("title", Left "Tutorials") + , ("tutorials", Right tutorialList) + ] + renderChain ["templates/tutorials.html", "templates/default.html"] tutorialPage + + mapM_ render' $ [ "about.markdown" + , "index.markdown" + ] ++ tutorials where render' = renderChain ["templates/default.html"] . createPagePath diff --git a/examples/hakyll/templates/tutorialitem.html b/examples/hakyll/templates/tutorialitem.html new file mode 100644 index 0000000..01fb298 --- /dev/null +++ b/examples/hakyll/templates/tutorialitem.html @@ -0,0 +1,3 @@ +<li> + <a href="$url">$title</a> $what. +</li> diff --git a/examples/hakyll/templates/tutorials.html b/examples/hakyll/templates/tutorials.html new file mode 100644 index 0000000..eb0126d --- /dev/null +++ b/examples/hakyll/templates/tutorials.html @@ -0,0 +1,7 @@ +<h2>Tutorials about hakyll</h2> +<p> + Here is a list of tutorials I've written about hakyll: +</p> +<ul> + $tutorials +</ul> diff --git a/examples/hakyll/tutorial1.markdown b/examples/hakyll/tutorial1.markdown index 2e4dcd2..56fb9e4 100644 --- a/examples/hakyll/tutorial1.markdown +++ b/examples/hakyll/tutorial1.markdown @@ -1,5 +1,6 @@ --- title: Tutorial (Part I) +what: explains how to create a simple brochure site --- ## Getting started diff --git a/examples/hakyll/tutorial2.markdown b/examples/hakyll/tutorial2.markdown index be8fcca..16521ac 100644 --- a/examples/hakyll/tutorial2.markdown +++ b/examples/hakyll/tutorial2.markdown @@ -1,5 +1,6 @@ --- title: Tutorial (Part II) +what: creates a simple blog --- ## Creating a simple blog with Hakyll diff --git a/examples/hakyll/tutorial3.markdown b/examples/hakyll/tutorial3.markdown index 0a2a1ff..2c3acf9 100644 --- a/examples/hakyll/tutorial3.markdown +++ b/examples/hakyll/tutorial3.markdown @@ -1,5 +1,6 @@ --- title: Tutorial (Part III) +what: adds an RSS feed to the blog from the previous tutorial --- ## Adding RSS to our simple blog diff --git a/examples/hakyll/tutorials.markdown b/examples/hakyll/tutorials.markdown deleted file mode 100644 index fa56346..0000000 --- a/examples/hakyll/tutorials.markdown +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: Tutorials ---- - -## Tutorials about hakyll - -Here is a list of tutorials I've written about hakyll: - -- [Tutorial 1](tutorial1.html) explains how to create a simple brochure site. -- [Tutorial 2](tutorial2.html) creates a simple blog. -- [Tutorial 3](tutorial3.html) adds an RSS feed to the blog from the previous - tutorial. |