haskellyesodhamlet

How to append key / value pair to url generated in a hamlet block in yesod


I want to make a link that appends a key / value pair to the URL on a href inside of a hamlet block.

<p><a href=@{LoadingProcessesR}?"processlist"=#{newList}>Continue

The above doesn't seem to quite work. I was able to get it working in another section outside of hamlet like the following.

redirect (LoadingProcessesR, [("processlist", newList)])

I found a similar example in the Yesod book but I'm having trouble translating it to what I want.

<a href=@{Link1R}#somehash>Link to hash

The above is the example but it is for appending a # variable to the URL. I tried a few variations substituting the # with ? but so far nothing is working.

I just want the link to go to /loadingprocesses?processlist=<variable>


Solution

  • I was so close. It is all string literals. The quotes were messing everything up. This works now.

    <p><a href=@{LoadingProcessesR}?processlist=#{newList}>Continue