Wrapping Phoenix img_tag with Phoenix link

The summer heat in Japan must be getting to me… I was looking through the online Phoenix documentation and looking for a nice way to wrap images with urls programmatically. The best I could come up was this:

link to: (@category01[:url]) do 

Just wondering if there is a more idiomatic or cleaner way?

1 Like

link/2 should be able to handle safe-HTML while img_tag/2 does return safe-HTML, so the code below should work:

|> img_tag()
|> link(to: @category01[:url])

Nice! :023: