Adds OgEx declarations to a Phoenix controller's render/3 call.
Use it after the application's normal controller setup:
use MyAppWeb, :controller
use OgEx.ControllerA render may select a generated card:
render(conn, :show, post: post, og: MyAppWeb.PostOgCard)Or an existing image:
render(conn, :about,
og: [title: "About Acme", image: "/images/about-og.png"]
)Calls without :og keep normal Phoenix behavior.
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.
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.
Dispatches a controller render to either Phoenix HTML or an OgEx image.
Without :og, this delegates to Phoenix.Controller.render/3.
With a card module, normal requests register generated-image metadata and signed requests return the card image. With direct metadata, public and external sources are emitted as existing URLs while private sources use a signed response.
This function expects controller render options as a keyword list or map.