is it possible to add html-content inside a link_to helper in HAML?
i tried this, but all i get is a syntax error:
= link_to "Other page", "path/to/page.html" %span.icon Arrow
expected output:
<a href="path/to/page.html">Other Page<span class="icon">Arrow</span></a>
You should use block
= link_to "path/to/page.html" do Other page %span.icon Arrow
If anyone is still using Rails 2.x on a project, it looks like the accepted answer returns the block, thus duplicating the link in the markup. Very simple change: use -
instead of =
- link_to "path/to/page.html" do Other page %span.icon Arrow
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With