PhoenixKit. Modules. Publishing. Web. Controller
(PhoenixKitPublishing v0.5.1)
Copy Markdown
View Source
Public post display controller.
Handles public-facing routes for viewing published posts with multi-language support.
URL patterns: /:language/:group_slug/:post_slug - Slug mode post /:language/:group_slug/:date/:time - Timestamp mode post /:language/:group_slug - Group listing
Architecture
This controller delegates to specialized submodules:
Routing- URL path parsing and segment buildingLanguage- Language detection and resolutionSlugResolution- URL slug resolution and redirectsPostFetching- Post retrieval from cache/databaseListing- Group listing rendering and paginationPostRendering- Post rendering and version handlingTranslations- Translation link buildingFallback- 404 handling and smart fallback chain
Summary
Functions
Public comment submission (the dead-view POST form on post pages).
Displays a post, group listing, or all groups overview.
Functions
Public comment submission (the dead-view POST form on post pages).
Guards, in order: module+public on, the group exists and has
comments_enabled, the comments seam is available, honeypot empty, the
signed form token is 3sā1day old (bots submit instantly; stale tabs
re-render), the post uuid belongs to the group's published set, and the
reader is logged in. Plain form posts get a flash + redirect back to the
post (or the group listing when the post can't be resolved); requests
from the page's fetch enhancement (x-pk-comment-fetch header) get a
JSON verdict instead so the client can swap the thread in place.
Displays a post, group listing, or all groups overview.
Path parsing determines which action to take:
- [] -> Invalid request (no group specified)
- [group_slug] -> Group listing
- [group_slug, post_slug] -> Slug mode post
- [group_slug, date] -> Date-only timestamp (resolves to single post or first post)
- [group_slug, date, time] -> Timestamp mode post