PhoenixKit.Modules.Publishing.Web.Controller.SlugResolution (phoenix_kit v1.7.42)
Copy Markdown View SourceURL slug resolution for the publishing controller.
Handles resolving URL slugs to internal slugs, including:
- Per-language custom URL slugs
- Previous URL slugs for 301 redirects
- Filesystem fallback when cache is unavailable
Summary
Functions
Builds redirect URL for 301 redirects from cached post data.
Builds redirect URL when we only have slug data (no full post struct).
Finds the latest version directory in a versioned post structure.
Scans filesystem to find a post with matching url_slug or previous_url_slugs.
Reads url_slug and previous_url_slugs from a post's language file metadata.
Resolves URL slug to internal slug using cache.
Filesystem fallback for URL slug resolution when cache is unavailable. Also handles 301 redirects for previous_url_slugs.
Resolves a URL slug to the internal directory slug. Used by versioned URL handler and other places that need the internal slug.
Functions
Builds redirect URL for 301 redirects from cached post data.
Builds redirect URL when we only have slug data (no full post struct).
Finds the latest version directory in a versioned post structure.
Scans filesystem to find a post with matching url_slug or previous_url_slugs.
Returns:
{:current, internal_slug}- found as current url_slug{:previous, internal_slug, current_url_slug}- found in previous_url_slugs (for redirect){:error, reason}- not found
Reads url_slug and previous_url_slugs from a post's language file metadata.
Resolves URL slug to internal slug using cache.
Returns:
{:redirect, url}for 301 redirect to new URL{:ok, identifier}for resolved internal slug:passthroughfor direct use
Filesystem fallback for URL slug resolution when cache is unavailable. Also handles 301 redirects for previous_url_slugs.
Resolves a URL slug to the internal directory slug. Used by versioned URL handler and other places that need the internal slug.