'Hamlet route for OptionalSubsite
I am using an OptionalSubsite as shown here: https://gist.github.com/snoyberg/8d85d41c5b4d0da002ae
How can I create a hamlet link/route to a file that is served in this subsite?
$if servingOptionalSite
<a href="@{StaticR (routeToOptionalFile)}">Docs
I can not rely on template haskell functions such as staticFiles to generate routes for the contents of the served folder because it is not always existent, hence OptionalSubsite.
Solution 1:[1]
I solved it with
optionalRouteR = OptionalRoute $ StaticRoute ["index.html"] []
which can then be used in hamlet
<a href="@{StaticR optionalRouteR}">Docs
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | m1-s |
