PhoenixKit.Modules.Publishing.Web.Controller.PostRendering (phoenix_kit v1.7.33)

Copy Markdown View Source

Post rendering functionality for the publishing controller.

Handles rendering individual posts including:

  • Content rendering with caching
  • Versioned post display
  • Date-only URL handling
  • Version dropdown building

Summary

Functions

Builds breadcrumbs for a post page.

Builds a timestamp URL with date and time.

Builds version dropdown data for the public post template. Returns nil if version access is disabled or only one published version exists. Uses listing cache for fast lookups instead of reading files.

Builds URL for a specific version of a post.

Gets version info from cache (allow_version_access and live_version). Falls back to file reads if cache miss.

Handles date-only URLs (e.g., /blog/2025-12-09). If only one post exists on that date, render it directly. If multiple posts exist, redirect to the first one with time in URL.

Checks if a specific post allows public access to older versions. Always reads from the primary language's live version to ensure consistency.

Renders a post after resolving URL slugs.

Renders post content with caching for published posts. Uses Renderer.render_post/1 which caches based on content hash.

Renders a post after identifier has been resolved.

Renders a specific version of a post (for version browsing feature).

Functions

build_breadcrumbs(blog_slug, post, language)

Builds breadcrumbs for a post page.

build_timestamp_url(blog_slug, date, time, language)

Builds a timestamp URL with date and time.

build_version_dropdown(blog_slug, post, language)

Builds version dropdown data for the public post template. Returns nil if version access is disabled or only one published version exists. Uses listing cache for fast lookups instead of reading files.

build_version_url(blog_slug, post, language, version)

Builds URL for a specific version of a post.

get_cached_version_info(blog_slug, current_post)

Gets version info from cache (allow_version_access and live_version). Falls back to file reads if cache miss.

handle_date_only_url(conn, blog_slug, date, language)

Handles date-only URLs (e.g., /blog/2025-12-09). If only one post exists on that date, render it directly. If multiple posts exist, redirect to the first one with time in URL.

post_allows_version_access?(blog_slug, post_slug, language)

Checks if a specific post allows public access to older versions. Always reads from the primary language's live version to ensure consistency.

render_post(conn, blog_slug, identifier, language)

Renders a post after resolving URL slugs.

render_post_content(post)

Renders post content with caching for published posts. Uses Renderer.render_post/1 which caches based on content hash.

render_resolved_post(conn, blog_slug, identifier, language)

Renders a post after identifier has been resolved.

render_versioned_post(conn, blog_slug, url_slug, version, language)

Renders a specific version of a post (for version browsing feature).