Enhancements
- Adds
MyApp.Router.LocalizedHelpers.<helper>_links
functions to the generated LocalizedHelpers
module. These _links
functions are 1:1 correspondents to the _path
and _url
helpers. The _link
helpers generate link headers that help identify the other language versions of a page. They are used like this:
iex> alias MyApp.Router.LocalizedHelpers, as: Routes
iex> Routes.user_links(conn, :show, 1) |> Routes.hreflang_links()
{
:safe,
[
["<link href=", "\"http://localhost/users_de/1\"", "; rel=alternate; hreflang=", "\"de\"", " />"],
"\n",
["<link href=", "\"http://localhost/users/1\"", "; rel=alternate; hreflang=", "\"en\"", " />"],
"\n",
["<link href=", "\"http://localhost/users_fr/1\"", "; rel=alternate; hreflang=", "\"fr\"", " />"]
]
}