Helpers for prettier links by relying on auto-index

Add a route and context helper to make it easier to have "pretty" links.

For example, `route $ indexRoute converter` makes:

`posts/foo/bar/2015-01-01-some_post.md`

Route to:

`posts/foo/bar/some_post/index.html`

(assuming `converter` strips the date prefix and markdown extension)

Then, `indexedUrlField "url"` makes:

`$url$`

Show:

`/posts/foo/bar/some_post/`

In your template.

So long as auto-index is enabled on your server, visiting this URL will render the generated index.html.

Edit: updated usage based on @nagisa 's feedback.
Oh good point! I'll use Posix functions for both then.
On Dec 7, 2014 1:50 PM, "Alexey Kreschuk" <notifications@github.com> wrote:

> In src/Hakyll/Web/Template/Context.hs:
>
> > @@ -182,6 +184,20 @@ urlField key = field key $
> >
> >
> >  --------------------------------------------------------------------------------
> > +-- | Absolute url to the resulting item with a trailing @index.html@ removed if
> > +-- present
> > +indexedUrlField :: String -> Context a
> > +indexedUrlField = mapContext stripIndex . urlField
> > +
> > +  where
> > +    stripIndex :: String -> String
> > +    stripIndex url =
> > +        case splitFileName url of
> > +            (path, "index.html") -> dropWhileEnd (== '/') path
>
> Then you could use System.FilePath.Posix.dropTrailingPathSeparator.
> And if it's not a filename, why do you use System.FilePath.splitFileName?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/jaspervdj/hakyll/pull/315/files#r21426903>.
>