Adds action-level social-card declarations to a Phoenix controller.
Use it after the application's normal controller setup:
use MyAppWeb, :controller
use OgEx.ControllerDeclare a generated card once:
og_card :show, MyAppWeb.PostOgCardThe card's load/2 callback runs only for signed image requests. An explicit
controller loader can override it:
og_card :show, MyAppWeb.PostOgCard,
load: &load_post_card/2,
image_route: :queryExisting render(..., og: Card) and direct-image declarations remain
supported for compatibility.
The README contains complete controller actions for generated cards, embedded image resources, and direct existing images.
Summary
Functions
Installs an OgEx-aware local render/3 in the consuming controller.
Intercepts declaration-based query image requests before controller actions.
Declares the card used by one controller action.
Dispatches a controller render to Phoenix HTML or a legacy OgEx image.
Functions
Installs an OgEx-aware local render/3 in the consuming controller.
The generated function delegates to render/3 in this module. Install the
integration after the application's normal controller setup so OgEx can
replace Phoenix's imported render/3.
Intercepts declaration-based query image requests before controller actions.
Declares the card used by one controller action.
The card's optional load/2 callback supplies assigns for standalone image
requests. Pass load: &function/2 to override card-local loading.
Dispatches a controller render to Phoenix HTML or a legacy OgEx image.
Without :og, this delegates to Phoenix.Controller.render/3.
A declared action automatically selects its card when no explicit :og
option exists. Query image requests for declared actions are intercepted by
the controller plug before this function or the action executes.
This function expects controller render options as a keyword list or map.