Skip to content

OpenGraph

v0.4.0

Designed og:image templates, assigned per scope and rendered to PNG

Install OpenGraph

Design OpenGraph preview images in a canvas editor, assign templates to scopes such as a post, a group or a module-wide default, and render them to PNG on demand. Templates and assignments are stored in two tables; rendering uses the resvg NIF and is cached on disk. Other modules plug in through og_variables/0 and og_resolve/2, with phoenix_kit_publishing as the reference consumer.

Use it when

  • You want every page's social preview image generated from its title and image
  • Different sections of your site need different preview-image designs

What it gives you

  • SVG canvas editor with text, image, rect and stamp elements
  • {{slot}} variables and [[global]] variables (site URL, name, locale)
  • Hierarchical assignments, first match wins
  • PNG rendering via resvg with CLI fallbacks, disk cache by content hash
  • Kill switch and pass-through on error

Example

From the README
og = PhoenixKitOG.refine_og(og, conn, post, language)

OpenGraph news

Nothing posted about OpenGraph yet. Read its changelog or see all PhoenixKit news.

Install

1 Add to mix.exs

deps
{:phoenix_kit_og, "~> 0.4"}

2 Fetch it and run its migrations

Terminal
$ mix deps.get && mix phoenix_kit.update

3 Switch it on in /admin/modules

Package
phoenix_kit_og
Releases
  1. 0.4.0
  2. 0.3.9
  3. 0.3.8
Admin
/admin/open-graph

Related modules

What it needs, what builds on it, and its neighbours in Content & community.