on master help sign in
Wrote about index url's in a tutorial.
627ad76Jasper Van der Jeugt
examples/hakyll/tutorial7.markdown+32
@@ -17,3 +17,35 @@ refresh in your browser. There is one more thing to note: this will not update
17your site automatically when `hakyll.hs` changes. So if you make any changes to
17your site automatically when `hakyll.hs` changes. So if you make any changes to
18the configuration file, you'll have to compile it again, and then you can enter
18the configuration file, you'll have to compile it again, and then you can enter
19`preview` mode again.
19`preview` mode again.
20+
21+## Pretty URL's
22+
23+There is an option in Hakyll to produce pretty URL's, which is disabled by
24+default because it can be confusing when you're first introduced to Hakyll.
25+
26+It can be enabled this way:
27+
28+~~~~~{.haskell}
29+import Text.Hakyll
30+import Text.Hakyll.Hakyll
31+
32+myHakyllConfiguration :: HakyllConfiguration
33+myHakyllConfiguration = defaultHakyllConfiguration
34+ { enableIndexUrl = True
35+ }
36+
37+main = hakyllWithConfiguration HakyllConfiguration $ do
38+ -- Further code here
39+~~~~~
40+
41+The effect will be that the internal `toUrl` function will behave differently.
42+A few examples:
43+
44+- `about.html` will be rendered to `about/index.html`.
45+- `posts/2010-02-16-a-post.markdown` will be rendered to
46+ `posts/2010-02-16-a-post/index.html`.
47+- However, `index.markdown` will still be rendered to `index.html`. Likewise,
48+ `posts/index.html` would be rendered to `posts.index.html`.
49+
50+The benefit of this is simply prettier URL's. That is, if you consider
51+`example.com/about` prettier than `example.com/about.html`.