Open rniii opened 3 months ago
Not so sure how to implement this with the current code, but I got a custom lookup function to do this as a bit of a hack:
lookup pieces =
case reverse pieces of
name : pieces'
| T.null $ T.dropWhile (/= '.') (fromPiece name) ->
defaultLookup . reverse $
unsafeToPiece (fromPiece name <> ".html") : pieces'
_ -> defaultLookup pieces
Currently
index.html
files can be served byssIndices
, but it'd be useful if you could serve HTML files without an extension, e.g.posts/mypost.html
->posts/mypost
Alternatives
wai-extra
's rewrite middleware could be used to add the.html
extension on every request, but this would then breakindex.html
files. Conditionally rewriting on whether the path ends with a/
is also possible, but this would cause a lot of confusion and wouldn't match how frameworks usually serve static HTML