Hamlet route for OptionalSubsite

49 Views Asked by At

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.

1

There are 1 best solutions below

0
m1-s On

I solved it with

optionalRouteR = OptionalRoute $ StaticRoute ["index.html"] []

which can then be used in hamlet

<a href="@{StaticR optionalRouteR}">Docs