on master help sign in
Update create/match in example/tutorial
e477ea7Jasper Van der Jeugt
data/example/site.hs+1−1
@@ -29,7 +29,7 @@ main = hakyll $ do
29 >>= loadAndApplyTemplate "templates/default.html" postCtx
29 >>= loadAndApplyTemplate "templates/default.html" postCtx
30 >>= relativizeUrls
30 >>= relativizeUrls
31
31
32− match "archive.html" $ do
32+ create ["archive.html"] $ do
33 route idRoute
33 route idRoute
34 compile $ do
34 compile $ do
35 let archiveCtx =
35 let archiveCtx =
web/tutorials/03-rules-routes-compilers.markdown+19
@@ -46,6 +46,25 @@ and all files in the `css/` directory.
46
46
47[Pattern]: /reference/Hakyll-Core-Identifier-Pattern.html
47[Pattern]: /reference/Hakyll-Core-Identifier-Pattern.html
48
48
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+
49Basic routes
68Basic routes
50------------
69------------
51
70