summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2010-02-16 22:37:43 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2010-02-16 22:37:43 +0100
commit627ad76ca65a118f4e9a092217ec04799df27817 (patch)
tree6710a9c339b090f68aab157e0b691eb4b3bf3efc
parentc9d4624a42c231ed200b69f1d6bf51c323febbbb (diff)
downloadhakyll-627ad76ca65a118f4e9a092217ec04799df27817.tar.gz
Wrote about index url's in a tutorial.
-rw-r--r--examples/hakyll/tutorial7.markdown32
1 files changed, 32 insertions, 0 deletions
diff --git a/examples/hakyll/tutorial7.markdown b/examples/hakyll/tutorial7.markdown
index 0fd6d75..cc6485a 100644
--- a/examples/hakyll/tutorial7.markdown
+++ b/examples/hakyll/tutorial7.markdown
@@ -17,3 +17,35 @@ refresh in your browser. There is one more thing to note: this will not update
your site automatically when `hakyll.hs` changes. So if you make any changes to
the configuration file, you'll have to compile it again, and then you can enter
`preview` mode again.
+
+## Pretty URL's
+
+There is an option in Hakyll to produce pretty URL's, which is disabled by
+default because it can be confusing when you're first introduced to Hakyll.
+
+It can be enabled this way:
+
+~~~~~{.haskell}
+import Text.Hakyll
+import Text.Hakyll.Hakyll
+
+myHakyllConfiguration :: HakyllConfiguration
+myHakyllConfiguration = defaultHakyllConfiguration
+ { enableIndexUrl = True
+ }
+
+main = hakyllWithConfiguration HakyllConfiguration $ do
+ -- Further code here
+~~~~~
+
+The effect will be that the internal `toUrl` function will behave differently.
+A few examples:
+
+- `about.html` will be rendered to `about/index.html`.
+- `posts/2010-02-16-a-post.markdown` will be rendered to
+ `posts/2010-02-16-a-post/index.html`.
+- However, `index.markdown` will still be rendered to `index.html`. Likewise,
+ `posts/index.html` would be rendered to `posts.index.html`.
+
+The benefit of this is simply prettier URL's. That is, if you consider
+`example.com/about` prettier than `example.com/about.html`.