OpenGraph 0.1.0: Designed social share images for Publishing posts
OpenGraph 0.1.0 is the first release of the PhoenixKit module for share images. Instead of making a picture by hand for every page, you design a template once, and the site renders each post’s og:image from it as a PNG.
A canvas editor for templates
The module adds an OpenGraph tab to the admin, with Templates and Assignments under it at /admin/open-graph. A template is a canvas, 1200×630 by default, with text, image, rectangle and stamp elements. Text can be fixed or hold variables. A {{slot}} is a placeholder that the module using the template fills in, such as a post’s title or featured image. A [[global]] is filled automatically: Site URL, Site host, Site name, Page URL and Page locale. The editor saves on its own shortly after each edit, and Ctrl+S saves at once. Preview in social cards shows the rendered image in mockups of Facebook, X, LinkedIn and Discord or Slack cards.
Assignments by group or for the whole module
On the Assignments page you choose which template applies where. The first consumer is Publishing: a template can cover the Whole Publishing module (default) or A specific Publishing group, and the most specific match wins. In the assignment modal you wire each slot to one of the variables Publishing offers, and you can preview the result against a real post of a group.
Rendering and serving
Images are drawn as SVG and turned into PNG. The module prefers the resvg library and falls back to the resvg command, rsvg-convert or ImageMagick. Each result is cached on disk and served from /phoenix_kit/og-image/:key as image/png with a 30-day cache header. If the module is off, no template matches or anything fails, the page keeps its own og:image, so a broken template cannot break a public page. Creating, changing and deleting templates and assignments is written to the activity log.
Upgrading
Add {:phoenix_kit_og, "~> 0.1"} next to phoenix_kit 1.7, run mix deps.get, and turn the module on from the PhoenixKit admin; it is off by default. Its two tables come from core’s migration V154, so run mix phoenix_kit.update if your core is older. Share images only change for Publishing pages, and only once a template is assigned.
Full release notes: OpenGraph 0.1.0
0.1.0 · 4 July 2026
Added
- WYSIWYG SVG canvas editor for OpenGraph image templates — text, image, rect,
and stamp elements, with
{{slot}}(consumer-wired) and[[global]](site_url, site_host, site_name, page_url, page_locale) variable syntax - Hierarchical template assignment system (e.g.
post → group → default); admin modal for CRUD plus live preview against a real published resource - SVG → PNG rendering pipeline (
Render.render_url/2): prefers the:resvgNIF, falls back to theresvgCLI,rsvg-convert, or ImageMagick; disk cache keyed by a SHA-256 of(template, canvas, values, module_key) refine_og/4integration seam for consumer modules — kill-switch viaenabled?/0, pass-through on any resolution error or missing template so a public page render can never crash on OG renderingpreview_og_image_url/3for consumer editors to show “what the plugin will produce” without swapping the live OG imageGET /phoenix_kit/og-image/:keyimage controller —image/pngwithout a charset suffix (Telegram drops previews on binary MIME with a text charset), 30-day immutable cache headers, configurable cache directory- Consumer opt-in via two callbacks on the consumer’s
PhoenixKit.Moduleimplementation:og_variables/0(declares available variables) andog_resolve/2(fetches values at render time); first consumer wired up isphoenix_kit_publishing - Activity logging for template and assignment CRUD
- Admin dashboard integration: OpenGraph overview tab plus Templates and Assignments subtabs
phoenix_kit_og_templatesandphoenix_kit_og_assignmentsschemas (migration V154), with a partial-unique-index pair so Postgres NULLscope_uuid(module-wide default) and per-scope assignments don’t collide
Fixed
- The template editor’s
/newroute no longer leaks an orphaned template row on every fresh page load — creation is now gated onconnected?/1since LiveView mounts twice (disconnected + connected) for a full page load Render.Svgno longer hardcodeshttp://localhost:4000for host-relative image sources (e.g. the signed local-storage fallback URL); it now degrades the same way any other unresolvable image href does
OpenGraph 0.1.0. Install or update: {:phoenix_kit_og, "~> 0.1"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.