OpenGraph template + hierarchical assignment plugin for PhoenixKit.
See AGENTS.md for the high-level architecture. The integration seam
with phoenix_kit_publishing is refine_og/4 — publishing's
Web.Controller.build_og_data/4 calls it when this module is loaded.
Module callbacks
Implements PhoenixKit.Module so the host app's discovery picks this
up automatically — no config line. Settings key: phoenix_kit_og_enabled.
Summary
Functions
Returns {:ok, url} with the OG-plugin-generated image for a post,
or :none when no template resolves. Used by publishing's editor to
render a "what the plugin will produce" preview alongside the manual
OG-image override.
The seam phoenix_kit_publishing calls. Walks the hierarchy, picks the
winning template, and would (in Phase 3) substitute a rendered-image URL
into og[:image].
Functions
@spec preview_og_image_url(map(), Plug.Conn.t() | nil, String.t() | nil) :: {:ok, String.t()} | :none
Returns {:ok, url} with the OG-plugin-generated image for a post,
or :none when no template resolves. Used by publishing's editor to
render a "what the plugin will produce" preview alongside the manual
OG-image override.
@spec refine_og(map(), Plug.Conn.t() | nil, map(), String.t() | nil) :: map()
The seam phoenix_kit_publishing calls. Walks the hierarchy, picks the
winning template, and would (in Phase 3) substitute a rendered-image URL
into og[:image].
Today it's a pass-through: if no template wins, return og unchanged.
When a template wins, it still returns og unchanged but logs the
resolution — once the renderer ships, this is where we swap og[:image]
for the rendered URL.
The seam contract: return a map with the same keys (:title,
:description, :image, :url, :locale, :type). Anything else is
ignored by publishing's HTML renderer.