Search documentation of phoenix_kit

# PhoenixKit.Utils.Routes (phoenix_kit v1.6.19)

View Source

Utility functions for working with PhoenixKit routes and URLs.

This module provides helpers for constructing URLs with the correct PhoenixKit prefix configured in the application.

# Summary

## Functions

locale_aware_path(assigns, url_path)

Returns a locale-aware path using locale from assigns.

path(url_path, opts \\ [])
url(url_path)

Returns a full url with preconfigured prefix.

# Functions

# locale_aware_path(assigns, url_path)

Returns a locale-aware path using locale from assigns.

This function is specifically designed for use in component templates where the locale needs to be passed explicitly via assigns.

Prefers base locale code for URL generation (current_locale_base), falls back to extracting base from full dialect code (current_locale).

# path(url_path, opts \\ [])

# url(url_path)

Returns a full url with preconfigured prefix.

This function first checks for a configured site URL in Settings, then automatically detects the correct URL from the running Phoenix application endpoint when possible, falling back to static configuration. This ensures that magic links and other email links work correctly in both development and production environments, with full control over the base URL through the Settings admin panel.