@@ -0,0 +1,60 @@
1+---
2+title: Interlude
3+what: some various tips and tricks about Hakyll
4+---
5+
6+## Auto-compilation
7+
8+Hakyll features a simple _auto-compilation_ mode. This is invoked by running
9+
10+~~~~~
11+[jasper@alice ~]$ ./hakyll preview
12+Starting hakyll server on port 8000...
13+~~~~~
14+
15+Now, Hakyll will recompile your site when you change files, so you can just
16+refresh in your browser. There is one more thing to note: this will not update
17+your site automatically when `hakyll.hs` changes. So if you make any changes to
18+the configuration file, you'll have to compile it again, and then you can enter
19+`preview` mode again.
20+
21+## When to rebuild
22+
23+If you execute a `./hakyll build`, Hakyll will build your site incrementally.
24+This means it will be very fast, but it will not pick up _all_ changes.
25+
26+- In case you edited `hakyll.hs`, you first want to compile it again.
27+- It is generally recommended to do a `./hakyll rebuild` before you deploy your
28+ site.
29+
30+## Pretty URL's
31+
32+There is an option in Hakyll to produce pretty URL's, which is disabled by
33+default because it can be confusing when you're first introduced to Hakyll.
34+
35+It can be enabled this way:
36+
37+~~~~~{.haskell}
38+import Text.Hakyll
39+import Text.Hakyll.Hakyll
40+
41+myHakyllConfiguration :: HakyllConfiguration
42+myHakyllConfiguration = defaultHakyllConfiguration
43+ { enableIndexUrl = True
44+ }
45+
46+main = hakyllWithConfiguration HakyllConfiguration $ do
47+ -- Further code here
48+~~~~~
49+
50+The effect will be that the internal `toUrl` function will behave differently.
51+A few examples:
52+
53+- `about.html` will be rendered to `about/index.html`.
54+- `posts/2010-02-16-a-post.markdown` will be rendered to
55+ `posts/2010-02-16-a-post/index.html`.
56+- However, `index.markdown` will still be rendered to `index.html`. Likewise,
57+ `posts/index.html` would be rendered to `posts.index.html`.
58+
59+The benefit of this is simply prettier URL's. That is, if you consider
60+`example.com/about` prettier than `example.com/about.html`.