diff options
-rw-r--r-- | data/example/site.hs | 2 | ||||
-rw-r--r-- | web/tutorials/03-rules-routes-compilers.markdown | 19 |
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 ------------ |