PhoenixKit.Modules.Publishing.Constants (PhoenixKitPublishing v0.4.3)

Copy Markdown View Source

Centralized constants for the Publishing module.

Provides canonical lists for statuses, modes, and types used across schemas, business logic, and templates. Import or alias this module instead of hardcoding these values inline.

For guard clauses and pattern matches, use the module attributes:

@timestamp_modes Publishing.Constants.timestamp_modes()
@slug_modes Publishing.Constants.slug_modes()

def my_func(mode) when mode in @timestamp_modes do ...

Summary

Functions

Valid band styles for the Featured/Latest bands — the PAINT of a band card, orthogonal to its layout (which stays size/placement: hero band vs card in grid): "classic" (image beside/above the text — the original variants), "cover" (the featured image is the card's background, text overlaid on a gradient scrim), "cover_panel" (background image with an opaque text panel), "minimal" (text-only editorial band, image ignored), "top" (16:9 image banner stacked above the text).

Valid version and content statuses: draft, published, archived.

Default band style ("classic" — the pre-styles rendering, unchanged).

Default featured-post layout ("hero").

Default public-listing sort order ("newest" first).

Default group mode.

Default latest-post layout ("hero").

Default post-date position ("below" the title).

Default post-page content width ("normal").

Default scrollbar style ("default" — the browser's native bar, untouched).

Default date-timeline granularity ("auto").

Default title for posts without a title.

Default group type.

Valid featured-post layouts: "hero" (band above the grid) or "card" (larger card in the grid).

Valid group statuses: active, trashed.

Valid public-listing sort orders: "newest" or "oldest", by effective publish date.

Max length for group names.

Max length for group slugs.

Max length for language codes.

Max length for post/content slugs.

Max length for content titles.

Valid latest-post layouts: "hero" (band above the grid) or "card" (larger card in the grid).

Valid post-date positions relative to the title: "above", "below", or "hidden".

Valid post statuses: draft, published, archived, trashed.

Valid post-page content widths: "narrow", "normal", or "wide".

Preset group types (shown as radio buttons in UI).

Valid scrollbar styles: "default" (native, unstyled), "branded" (theme-colored), "thin" (theme-colored + thin).

Returns true if mode is a slug mode (atom or string).

Atom and string variants for slug mode — use in guards/pattern matches.

Valid date-timeline granularities: "auto" (fit to the posts' date span), "year", "month", or "day".

Returns true if mode is a timestamp mode (atom or string).

Atom and string variants for timestamp mode — use in guards/pattern matches.

Valid mode strings for schema validation.

All valid group types including custom.

Functions

band_styles()

Valid band styles for the Featured/Latest bands — the PAINT of a band card, orthogonal to its layout (which stays size/placement: hero band vs card in grid): "classic" (image beside/above the text — the original variants), "cover" (the featured image is the card's background, text overlaid on a gradient scrim), "cover_panel" (background image with an opaque text panel), "minimal" (text-only editorial band, image ignored), "top" (16:9 image banner stacked above the text).

content_statuses()

Valid version and content statuses: draft, published, archived.

default_band_style()

Default band style ("classic" — the pre-styles rendering, unchanged).

default_listing_sort()

Default public-listing sort order ("newest" first).

default_mode()

Default group mode.

default_newest_layout()

Default latest-post layout ("hero").

default_post_date_position()

Default post-date position ("below" the title).

default_post_width()

Default post-page content width ("normal").

default_scrollbar_style()

Default scrollbar style ("default" — the browser's native bar, untouched).

default_timeline_granularity()

Default date-timeline granularity ("auto").

default_title()

Default title for posts without a title.

default_type()

Default group type.

group_statuses()

Valid group statuses: active, trashed.

listing_sorts()

Valid public-listing sort orders: "newest" or "oldest", by effective publish date.

max_group_name_length()

Max length for group names.

max_group_slug_length()

Max length for group slugs.

max_language_code_length()

Max length for language codes.

max_slug_length()

Max length for post/content slugs.

max_title_length()

Max length for content titles.

newest_layouts()

Valid latest-post layouts: "hero" (band above the grid) or "card" (larger card in the grid).

post_date_positions()

Valid post-date positions relative to the title: "above", "below", or "hidden".

post_statuses()

Valid post statuses: draft, published, archived, trashed.

post_widths()

Valid post-page content widths: "narrow", "normal", or "wide".

preset_types()

Preset group types (shown as radio buttons in UI).

scrollbar_styles()

Valid scrollbar styles: "default" (native, unstyled), "branded" (theme-colored), "thin" (theme-colored + thin).

slug_mode?(mode)

Returns true if mode is a slug mode (atom or string).

slug_modes()

Atom and string variants for slug mode — use in guards/pattern matches.

timeline_granularities()

Valid date-timeline granularities: "auto" (fit to the posts' date span), "year", "month", or "day".

timestamp_mode?(mode)

Returns true if mode is a timestamp mode (atom or string).

timestamp_modes()

Atom and string variants for timestamp mode — use in guards/pattern matches.

valid_modes()

Valid mode strings for schema validation.

valid_types()

All valid group types including custom.