Slug validation and generation for the Publishing module.
Handles slug format validation, uniqueness checking (DB-only), URL slug validation for per-language slugs, and slug generation.
Summary
Functions
Clears custom url_slugs that conflict with a given directory slug.
Clears a specific url_slug from all translations of a single post (DB-only).
Generates a unique slug based on title and optional preferred slug.
Checks if a slug already exists within the given publishing group (DB-only).
Validates whether the given string is a slug and not a reserved language code.
Validates whether the given string is a valid slug format and not a reserved language code.
Validates a per-language URL slug for uniqueness within a group+language combination.
Functions
Clears custom url_slugs that conflict with a given directory slug.
Clears a specific url_slug from all translations of a single post (DB-only).
@spec generate_unique_slug(String.t(), String.t(), String.t() | nil, keyword()) :: {:ok, String.t()} | {:error, :invalid_format | :reserved_language_code}
Generates a unique slug based on title and optional preferred slug.
Checks if a slug already exists within the given publishing group (DB-only).
Validates whether the given string is a slug and not a reserved language code.
@spec validate_slug(String.t()) :: {:ok, String.t()} | {:error, :invalid_format | :reserved_language_code}
Validates whether the given string is a valid slug format and not a reserved language code.
@spec validate_url_slug(String.t(), String.t(), String.t(), String.t() | nil) :: {:ok, String.t()} | {:error, atom()}
Validates a per-language URL slug for uniqueness within a group+language combination.