Developers · Gutenberg

Open Graph Preview block for WordPress

Preview how your page looks when shared on Twitter/X, Facebook, LinkedIn, and Slack.

Get Blockenberg

Free Gutenberg block in Blockenberg. The inspector controls and front-end behavior on this page come from this block’s source, not a shared stub.

Get Blockenberg

What it actually does

Preview how your page looks when shared on Twitter/X, Facebook, LinkedIn, and Slack.

Inspector panels on this block: Page Info, Image Placeholder, Display, Twitter / X Colors, Facebook Colors, LinkedIn Colors, Slack Colors. Those titles come from index.js, not from a shared template.

Behavior controls: “Show platform” options: All platforms, Twitter / X, Facebook, LinkedIn, Slack; “Layout” options: Stacked (single column), Grid (2 columns).

Where to find it

Gutenberg inserter → Developers → search “Open Graph Preview” (block name `blockenberg/open-graph-preview` in block.json). Style it in the sidebar after insert.

How to use Open Graph Preview block for WordPress

  1. Install Blockenberg. Install from WordPress.org and activate the plugin.
  2. Insert the block. Edit a page, click +, search for “Open Graph Preview”, insert it. Category: Developers.
  3. Configure inspector controls that exist on this block. Open Page Info. Set “Page title”, “Description”, “URL (domain)”, “Site name”.
  4. Check the published page. The view script reads HTML data attributes: data-opts, data-rendered. The block editor preview may not run the same view script.

Inspector controls from this block’s code

ControlWhat the code does
Page titleText field in the inspector. block.json default: Your Amazing Blog Post Title That Grabs Attention. Saved as `pageTitle`.
DescriptionMultiline text field in the inspector. block.json default: A compelling description of your content that will appear when shared on social media platforms. Keep it under 160 characters for best results.. Saved as `pageDescription`.
URL (domain)Text field in the inspector. block.json default: yoursite.com. Saved as `pageUrl`.
Site nameText field in the inspector. block.json default: My Website. Saved as `siteName`.
Show descriptionOn/off toggle in the inspector. On by default. Saved as `showDescription`.
Show site nameOn/off toggle in the inspector. On by default. Saved as `showSiteName`.
EmojiText field in the inspector. block.json default: 🚀. Saved as `imageEmoji`.
Image heightNumeric range control in the inspector. Range 80–320. block.json default: 180. Saved as `imageHeight`.
Show platformSelect control; the chosen value is saved on the block. Options: All platforms; Twitter / X; Facebook; LinkedIn; Slack. block.json default: all. Saved as `platform`.
LayoutSelect control; the chosen value is saved on the block. Options: Stacked (single column); Grid (2 columns). block.json default: stacked. Saved as `layout`.
Wrapper border radiusNumeric range control in the inspector. Range 0–32. block.json default: 16. Saved as `borderRadius`.

What the front-end script actually does

When this is the right block

Notes from the implementation

viewScript: this folder’s frontend.js is enqueued on the front end for this block.

FAQ

How do I add the Open Graph Preview block in WordPress?

Install Blockenberg from WordPress.org, edit a page in the block editor, click +, and search for “Open Graph Preview”. It sits under Developers. After insert, open Page Info and set “Page title”, “Description”, “URL (domain)”, “Site name”.

What makes Open Graph Preview different from other Blockenberg blocks?

Preview how your page looks when shared on Twitter/X, Facebook, LinkedIn, and Slack. Inspector labels on this block include “Page title”, “Description”, “URL (domain)”, “Site name”.

Is the Open Graph Preview Gutenberg block free?

Yes. Open Graph Preview ships inside Blockenberg. Get the plugin from WordPress.org — no paid add-on is required for this block.

Can I style Open Graph Preview to match my theme?

Yes. Blockenberg’s shared typography and color panels apply here, plus any block-specific style controls listed on this page (panels: Page Info, Image Placeholder, Display, Twitter / X Colors).

Related developers blocks

Get Blockenberg

Install Blockenberg from WordPress.org, then insert Open Graph Preview from the Gutenberg inserter.

Get Blockenberg