on master help sign in
Update create/match in example/tutorial
commite477ea753b59657ba8d185986c646cc45c66fcec authorJasper Van der Jeugt <m@jaspervdj.be> dateSun 6 Jan 2013, 09:58 (14 years ago) parent18b6ac5
2 files changed+20−1
data/example/site.hs+1−1 web/tutorials/03-rules-routes-compilers.markdown+19
data/example/site.hs+1−1
@@ -29,7 +29,7 @@ main = hakyll $ do
2929 >>= loadAndApplyTemplate "templates/default.html" postCtx
3030 >>= relativizeUrls
3131
32− match "archive.html" $ do
32+ create ["archive.html"] $ do
3333 route idRoute
3434 compile $ do
3535 let archiveCtx =
web/tutorials/03-rules-routes-compilers.markdown+19
@@ -46,6 +46,25 @@ and all files in the `css/` directory.
4646
4747[Pattern]: /reference/Hakyll-Core-Identifier-Pattern.html
4848
49+However, we can see that one item makes no use of `match`, but uses `create`
50+instead.
51+
52+```haskell
53+create ["archive.html"] $ do
54+ route idRoute
55+ compile $ do
56+ ...
57+```
58+
59+Don't pay attention to the somewhat complicated-looking stuff in `compile` --
60+this will become clear soon. The real question here is why we use `create`
61+instead of `match`.
62+
63+The answer is simple: there is no `archive.html` file in our project directory!
64+So if we were to use `match`, no a file would be matched, and hence, nothing
65+would appear in the output directory. `create`, however, ensures the items
66+listed are always produced.
67+
4968Basic routes
5069------------
5170