@@ -22,7 +22,73 @@ In general, it's only necessary to use `rebuild` when you made changes to your
2222Basic rules
2323-----------
2424
25−TODO
25+Let's take a look at the `site.hs` file.
26+
27+```haskell
28+main :: IO ()
29+main = hakyll $ do
30+ ...
31+```
32+
33+Hakyll configurations are in the `Rules` monad. In order to run them, the
34+`hakyll` function is used, so your main function usually starts this way.
35+`hakyllWith` is also available, this function allows you specify a custom
36+[Configuration].
37+
38+[Configuration]: /reference/Hakyll-Core-Configuration.html
39+
40+Some actual rules look like this:
41+
42+```haskell
43+match "images/*" $ do
44+ route idRoute
45+ compile copyFileCompiler
46+
47+match "css/*" $ do
48+ route idRoute
49+ compile compressCssCompiler
50+
51+```
52+
53+This is a declarative DSL: the order in which you write the rules make little
54+difference: Hakyll will use dependency tracking to determine the correct order.
55+
56+We group the different rules using `match`. The first argument for `match` is a
57+[Pattern]. The `OverloadedStrings` extension allows us to just write `String`s
58+here, which are interpreted as globs --- all files in the `images/` directory,
59+and all files in the `css/` directory.
60+
61+[Pattern]: /reference/Hakyll-Core-Identifier-Pattern.html
62+
63+Basic routes
64+------------
65+
66+The `route` function is used for determining the output file. For example, you
67+probably want to write the processed contents of `contact.markdown` to
68+`_site/contact.html` and not `_site/contact.markdown`.
69+
70+`idRoute` is a commonly used and just keeps the filename. We use this for e.g.
71+the images and CSS files.
72+
73+`setExtension` is another common route which takes a single argument: the
74+extension of the resulting file. In order to route `contact.markdown` to
75+`_site/contact.html`, use:
76+
77+```haskell
78+route $ setExtension "html"
79+```
80+
81+`customRoute` is a more advanced higher-order function which allows for even
82+more customization. You want to route `contact.markdown` to
83+`_site/nwodkram.tcatnoc`? No problem, just use:
84+
85+```haskell
86+customRoute $ reverse . toFilePath
87+```
88+
89+More information can be found in the [Routes] module.
90+
91+[Routes]: /reference/Hakyll-Core-Routes.html
2692
2793## Images
2894