Skip to content

Commit

Permalink
Update create/match in example/tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
jaspervdj committed Jan 6, 2013
1 parent 18b6ac5 commit e477ea7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion data/example/site.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
19 changes: 19 additions & 0 deletions web/tutorials/03-rules-routes-compilers.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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
------------

Expand Down

0 comments on commit e477ea7

Please sign in to comment.