skanel
1
I have integrated bootstrap 4 successfully into my project, then I am trying to do
<a class="nav-link" href="/">Home <span class="sr-only">(current)</span></a>
I am trying to use phoenix template system , so I changed
<%= link "Home", to: page_path(@conn, :index), class: "nav-link" %>
How can I put
<span class="sr-only">(current)</span>
into the phoenix template system.
2 Likes
NobbZ
2
Roughly like this:
<%= link raw(~s'Home <span class="sr-only">(current)</span>'), to: page_path(@conn, :index), class: "nav-link" %>
Phoenix.HTML.raw/1
3 Likes
skanel
4
Thank you @NobbZ , it works for me now.
I forget ~s
NobbZ
5
Yeah, I only realised after posting, that there were quotes in the string, so I had to edit it into a sigil variant.
This should work as well.
<%= link to: page_path(@conn, :index), class: "nav-link" do %>
Home <span class="sr-only">(current)</span>
<% end %>
9 Likes