Today I Learned

hashrocket A Hashrocket project

Phoenix full url using sigil_p

Phoenix team has created the new sigil_p macro to build url paths in the newest version (1.7.0). And today I learned that if you need to use the full path, let's say to use an image on an email, then you'd need to wrap the sigil_p call on the url/1 function.

iex> ~p"/images/header.jpg"
# => "/images/header.jpg"

iex> url(~p"/images/header.jpg")
# => "http://localhost:4000/images/header.jpg"
See More #elixir TILs
Looking for help? At Hashrocket, we 💜 Elixir! From our many Elixir client projects, to sponsoring the Chicago Elixir Meetup, to the source code for this application, we are invested in this community. Contact us today to talk about your Elixir project.