Retro.Phoenix.HTML.Link (Retro v2.2.0) View Source

Toolkit for extending Phoenix.HTML.Link.

Link to this section Summary

Functions

Generates a external link to the given URL with vulnerability care. Get more details by reading

Link to this section Functions

Link to this function

external_link(opts, opts)

View Source (since 0.2.0)

Generates a external link to the given URL with vulnerability care. Get more details by reading:

This function is same as Phoenix.HTML.Link.link/2 except that it adds two additional options:

[
  target: "_blank",
  rel: "noopener noreferrer"
]

Examples

iex> external_link("open page", to: "https://example.com") |> Phoenix.HTML.safe_to_string
"<a href=\"https://example.com\" rel=\"noopener noreferrer\" target=\"_blank\">open page</a>"

iex> external_link("open page", to: "https://example.com", rel: "nofollow") |> Phoenix.HTML.safe_to_string
"<a href=\"https://example.com\" rel=\"noopener noreferrer nofollow\" target=\"_blank\">open page</a>"