PhoenixKitWeb.Users.AuthSEO (phoenix_kit v2.13.9)

Copy Markdown View Source

Canonical / hreflang assigns for the auth LiveViews whose path is stable and token-free (registration, log-in, magic-link registration request).

Mirrors PhoenixKitEcommerce.Web.SEOHelpers's contract so a multi-domain host wires one resolver for both the shop and auth surfaces: the canonical host per language comes from the workspace-wide config :phoenix_kit, :canonical_host_resolver, {mod, fun} MFA (nil or absent ⇒ the site-wide PhoenixKit.Utils.Routes.base_url/0, today's behavior). On a language's own resolved host the locale segment is dropped (Routes.path(url_path, locale: :none)) — the domain itself carries the language, so a /en (or any other) prefix on top of it would be redundant.

Deliberately excludes every token-bearing auth page (email confirmation, password reset, magic-link verify, QR-login confirm): a one-time token in the URL makes canonical/hreflang meaningless — there is no duplicate-content signal to consolidate — and actively wrong, since the link a search engine would be told about goes dead the moment the token is spent.

Setting these assigns is enough on its own: the root layout that renders @canonical_url / @hreflang_links into <head> is the HOST app's, per the same cross-package contract phoenix_kit_ecommerce's catalog pages already rely on (see PhoenixKitEcommerce.Web.SEOHelpers). Nothing here renders anything itself.

Summary

Functions

Canonical + hreflang assigns for a stable, token-free auth path, e.g. "/users/register".

Functions

seo_assigns(url_path)

@spec seo_assigns(String.t()) :: %{canonical_url: String.t(), hreflang_links: [map()]}

Canonical + hreflang assigns for a stable, token-free auth path, e.g. "/users/register".

hreflang_links is [] when Languages is disabled or fewer than two languages are enabled — one language is not a hreflang set.