问题
Is it possible to redirect to example.com/page#anchor
using redirect
and Yesod's routing system? If so, how?
回答1:
You can use getUrlRender
to get the URL renderer, and then append #anchor
to that. For example:
render <- getUrlRender
redirect $ render myRoute <> "#anchor"
It might be worth adding a convenience function to automate this process.
来源:https://stackoverflow.com/questions/20886254/yesod-redirect-to-anchor-on-page