summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2013-01-06 09:58:34 +0100
committerJasper Van der Jeugt <m@jaspervdj.be>2013-01-06 09:58:34 +0100
commite477ea753b59657ba8d185986c646cc45c66fcec (patch)
treec4d9b12ddbe54a232a1dbb4c641846c27f88f8b6
parent18b6ac5ad42e50e75b9ee9fcfc8aef00f5a00957 (diff)
downloadhakyll-e477ea753b59657ba8d185986c646cc45c66fcec.tar.gz
Update create/match in example/tutorial
-rw-r--r--data/example/site.hs2
-rw-r--r--web/tutorials/03-rules-routes-compilers.markdown19
2 files changed, 20 insertions, 1 deletions
diff --git a/data/example/site.hs b/data/example/site.hs
index 78ee587..bd1754f 100644
--- a/data/example/site.hs
+++ b/data/example/site.hs
@@ -29,7 +29,7 @@ main = hakyll $ do
>>= loadAndApplyTemplate "templates/default.html" postCtx
>>= relativizeUrls
- match "archive.html" $ do
+ create ["archive.html"] $ do
route idRoute
compile $ do
let archiveCtx =
diff --git a/web/tutorials/03-rules-routes-compilers.markdown b/web/tutorials/03-rules-routes-compilers.markdown
index b9e1c61..d587ab4 100644
--- a/web/tutorials/03-rules-routes-compilers.markdown
+++ b/web/tutorials/03-rules-routes-compilers.markdown
@@ -46,6 +46,25 @@ and all files in the `css/` directory.
[Pattern]: /reference/Hakyll-Core-Identifier-Pattern.html
+However, we can see that one item makes no use of `match`, but uses `create`
+instead.
+
+```haskell
+create ["archive.html"] $ do
+ route idRoute
+ compile $ do
+ ...
+```
+
+Don't pay attention to the somewhat complicated-looking stuff in `compile` --
+this will become clear soon. The real question here is why we use `create`
+instead of `match`.
+
+The answer is simple: there is no `archive.html` file in our project directory!
+So if we were to use `match`, no a file would be matched, and hence, nothing
+would appear in the output directory. `create`, however, ensures the items
+listed are always produced.
+
Basic routes
------------