diff --git a/CHANGELOG.md b/CHANGELOG.md
index c3a554f..46009d5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,15 +10,15 @@ This is the changelog for Cldr Routes version 0.6.0 released on July 24th, 2022.
```elixir
iex> alias MyApp.Router.LocalizedHelpers
iex> LocalizedHelpers.user_links(conn, :show, 1)
-...> |> LocalizedHelpers.hreflang_link_headers()
+...> |> LocalizedHelpers.hreflang_links()
{
:safe,
[
- [""],
+ [""],
"\n",
- [""],
+ [""],
"\n",
- [""]
+ [""]
]
}
```
diff --git a/lib/cldr/routes/helpers.ex b/lib/cldr/routes/helpers.ex
index 002cbc5..4a808c5 100644
--- a/lib/cldr/routes/helpers.ex
+++ b/lib/cldr/routes/helpers.ex
@@ -333,8 +333,8 @@ defmodule Cldr.Route.LocalizedHelpers do
@doc """
Generates an HTTP `Link` header for a given map of locale => URLs
- This function generates `Link` headers that should be placed in the
- `HEAD` section of an HTML document to indicate the different language
+ This function generates `` tags that should be placed in the
+ `
` section of an HTML document to indicate the different language
versions of a given page.
The `MyApp.Router.LocalizedHelpers._link` functions can
@@ -347,14 +347,14 @@ defmodule Cldr.Route.LocalizedHelpers do
### Example
===> MyApp.Helpers.LocalizedHelpers.user_links(conn, :show, 1)
- ...> |> MyApp.Helpers.LocalizedHelpers.hreflang_link_headers()
+ ...> |> MyApp.Helpers.LocalizedHelpers.hreflang_links()
"""
- @spec hreflang_link_headers(%{LocalizedHelpers.locale_name() => LocalizedHelpers.url()}) ::
+ @spec hreflang_links(%{LocalizedHelpers.locale_name() => LocalizedHelpers.url()}) ::
Phoenix.HTML.safe()
- def hreflang_link_headers(url_map) do
- Cldr.Route.LocalizedHelpers.hreflang_link_headers(url_map)
+ def hreflang_links(url_map) do
+ Cldr.Route.LocalizedHelpers.hreflang_links(url_map)
end
end
end
@@ -479,8 +479,8 @@ defmodule Cldr.Route.LocalizedHelpers do
@doc """
Generates an HTTP `Link` header for a given map of locale => URLs
- This function generates `Link` headers that should be placed in the
- `HEAD` section of an HTML document to indicate the different language
+ This function generates `` headers that should be placed in the
+ `` section of an HTML document to indicate the different language
versions of a given page.
The `MyApp.Router.LocalizedHelpers._link` functions can
@@ -497,18 +497,18 @@ defmodule Cldr.Route.LocalizedHelpers do
### Example
===> MyApp.Helpers.LocalizedHelpers.user_links(conn, :show, 1)
- ...> |> Cldr.Route.LocalizedHelpers.hreflang_link_headers()
+ ...> |> Cldr.Route.LocalizedHelpers.hreflang_links()
"""
- @spec hreflang_link_headers(%{locale_name() => url()}) :: Phoenix.HTML.safe()
- def hreflang_link_headers(url_map) do
- link_headers =
+ @spec hreflang_links(%{locale_name() => url()}) :: Phoenix.HTML.safe()
+ def hreflang_links(url_map) do
+ links =
for {locale, url} <- url_map do
- [""]
+ [""]
end
|> Enum.intersperse("\n")
- {:safe, link_headers}
+ {:safe, links}
end
@doc false
diff --git a/test/cldr_routes_test.exs b/test/cldr_routes_test.exs
index 45654b0..2c405ad 100644
--- a/test/cldr_routes_test.exs
+++ b/test/cldr_routes_test.exs
@@ -194,7 +194,7 @@ defmodule Cldr.Route.Test do
conn = get(build_conn(), "/users/1")
links = MyApp.Router.LocalizedHelpers.user_links(conn, :show, 1)
- header_io_data = MyApp.Router.LocalizedHelpers.hreflang_link_headers(links)
+ header_io_data = MyApp.Router.LocalizedHelpers.hreflang_links(links)
header = Phoenix.HTML.safe_to_string(header_io_data)
assert links == %{
@@ -206,25 +206,25 @@ defmodule Cldr.Route.Test do
assert header_io_data == {
:safe,
[
- [""],
+ [""],
"\n",
- [""],
+ [""],
"\n",
- [""]
+ [""]
]
}
assert header ==
- "\n" <>
- "\n" <>
- ""
+ "\n" <>
+ "\n" <>
+ ""
end
test "hreflang test helper for non-localized route" do
conn = get(build_conn(), "/not_localized/1")
links = MyApp.Router.LocalizedHelpers.not_localized_links(conn, :show, 1)
- header_io_data = MyApp.Router.LocalizedHelpers.hreflang_link_headers(links)
+ header_io_data = MyApp.Router.LocalizedHelpers.hreflang_links(links)
header = Phoenix.HTML.safe_to_string(header_io_data)
assert links == %{}