Social share and metadata images
This page is for theme designers who want shared links to look as designed. When someone shares a page, the social
network or chat program reads tags in the page's head (Open Graph og:* and twitter:*) and builds a preview card
from a title, a description and an image. The theme prints those tags; the content supplies the values. How to print
them is covered for site builders in Metadata and social sharing;
this page is what a designer decides.
Contents
- What the preview card is made of
- Where the values come from
- The share image
- A default image
- Title and description lengths
- Testing a preview
What the preview card is made of
| Tag | Content | Design concern |
|---|---|---|
og:title | the page title | length; brand suffix or not |
og:description | a short summary | length, tone |
og:image | an absolute image address, with width, height and alternative text | the image itself |
og:site_name | the site's name | consistent with the header |
twitter:* | the same values for that network |
The look of the card (its layout, fonts, colors) belongs to the network, not to you. You control the image and the words.
Where the values come from
The shipped themes differ:
- the simple theme prints
og:title,og:descriptionandog:typein itspage_head.tpl, from the page's metadata when it exists and from the site title and description otherwise; - the media theme includes the xrowmetadata extension's template
xrowmetadata/opengraph_image.tplfrom its head template, which printsog:image(with width, height, type and alternative text) andtwitter:image.
With the xrowmetadata extension, editors can fill a metadata field on objects of the classes that have one: title,
description, keywords, and an Open Graph image chosen from the media library. Its settings
(xrowmetadata.ini, group [OpenGraph]) name the image classes editors may choose, the attributes searched for a
picture (by default site_opengraph_image, image, site_logo, file), and the image alias used for the tag, by
default opengraph. The extension defines that alias as "scale down to fit 1200 by 1200". When the object has no own
choice, a default for the class is used, and when neither exists, no image tag is printed.
Check which of these your installation uses before designing; a site without xrowmetadata needs its own fields and templates (Metadata and social sharing).
The share image
Because the shipped alias scales down without cropping, the share image keeps the proportions of the picture editors chose. Networks then crop it into their own card shapes, which differ between networks and change over time. Practical rules:
- design share images in a landscape ratio; a portrait photo will be cut hard;
- keep the important part (faces, the logo, any text) in a safe area in the middle, away from all edges;
- avoid small text in share images; it is unreadable in a chat preview and cannot be translated;
- make sure the image works on light and dark backgrounds, because cards appear in both.
If the client wants a fixed share format for every page, that is a separate image field and a separate alias with a crop; agree it with the developer (Designing image crops and art direction).
A default image
Many pages have no picture at all. Design a default share image per site (and per brand in a multisite installation): the logo or a brand pattern on the brand color, inside the safe area. With xrowmetadata it can be set as the class default; without it, the head template falls back to it. The image is a normal file of the design or an object in the media library, decided with the developer.
Title and description lengths
The xrowmetadata edit form limits what editors write: by default 65 characters for the title and 150 for the
description ([EditorInputSettings] MaxTitle and MaxDescription). Write your examples to those limits, and design
the visible page title separately: the share title may be shorter than the headline.
Testing a preview
- Open the page source and check that the tags are present, with an absolute
https://image address. - Open the image address on its own: it must load without signing in.
- Paste the page address into the preview or debugging tool of the networks the client cares about, and into a chat program. Networks cache previews; their debugging tools can refresh them.
- Check a page with its own image, a page with only the class default, and a page with neither.
Related pages
- Metadata and social sharing
- Favicons and touch icons
- Designing for several brands in multisite
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.