PhoenixKit.Modules.Publishing.Web.Controller.Listing (phoenix_kit v1.7.62)

Copy Markdown View Source

Group listing functionality for the publishing controller.

Handles rendering post listings with:

  • Language filtering and fallback
  • Pagination
  • Translation link building for listings

Summary

Functions

Gets the default group listing path for a language.

Fetches group configuration by slug.

Filter posts to only include those that have a matching language file. Handles both exact matches and base code matches (e.g., "en" matches "en-US"). Uses preloaded language_statuses to avoid redundant file reads.

Strict version - only matches exact language, no fallback to base code.

Filters posts to only include published ones.

Find a matching language in available languages. Handles exact matches and base code matching.

Get the actual language that the fallback matched. Used to redirect to the correct URL when requested language has no content.

Gets the page number from params.

Gets the posts per page setting.

Paginates a list of posts.

Renders the group index page with resolved posts.

Resolves posts for the requested language, handling exact match vs fallback.

Functions

default_group_listing(language)

Gets the default group listing path for a language.

fetch_group(group_slug)

Fetches group configuration by slug.

filter_by_exact_language(posts, group_slug, language)

Filter posts to only include those that have a matching language file. Handles both exact matches and base code matches (e.g., "en" matches "en-US"). Uses preloaded language_statuses to avoid redundant file reads.

filter_by_exact_language_strict(posts, language)

Strict version - only matches exact language, no fallback to base code.

filter_published(posts)

Filters posts to only include published ones.

find_matching_language(language, available_languages)

Find a matching language in available languages. Handles exact matches and base code matching.

get_fallback_language(requested_language, posts)

Get the actual language that the fallback matched. Used to redirect to the correct URL when requested language has no content.

get_page_param(params)

Gets the page number from params.

get_per_page_setting()

Gets the posts per page setting.

paginate(posts, page, per_page)

Paginates a list of posts.

render_group_index(conn, ctx, all_posts)

Renders the group index page with resolved posts.

render_group_listing(conn, group_slug, language, params)

Renders a group listing page.

resolve_listing_posts_for_language(conn, ctx)

Resolves posts for the requested language, handling exact match vs fallback.