Learn how to check Open Graph images in Umbraco with Umbraco Automate, catching overlapping text and empty fields before a page goes live.
Articles on a website usually have a field for the Open Graph image, also called the share image, but editors often leave it empty. The page then has no Open Graph image, or it falls back to a default that does not represent the article. Filling the field in properly means designing an image in Canva, then testing it with an Open Graph checker or by sharing the link on WhatsApp to see if it renders correctly.
I wanted each article to get its own image automatically when it was published. I mentioned this to Paul Seal on a Teams call, and he told me he had been building a package that did exactly that, called Umbraco.Community.DynamicImages. So I installed it, configured it, published an article, and the share image was already sitting in the SEO tab.
The Article OG image template in the Dynamic Images designer
The package comes with its own designer. It works in layers, a bit like Canva, and I was surprised how much it does. Each layer binds to a field on the page, and you can upload your own fonts, add shapes and preview against a real page before you save. Each design is called a template, and a Usage tab lists the pages using one and flags any with no image.
Usage shows at a glance which articles still have no share image
Getting started
I installed the package on an Umbraco 17 site with the Clean Starter Kit:
In the backoffice, give your user group access to the Dynamic Images section, add a font, then create a Dynamic Images template. In its Settings tab, pick the document types it applies to, and the media picker property on them that it fills (add that property to the document type first if it doesn't have one).
A template's Settings tab, set to Article and the Social Share Image property
Checking the image before it goes out
I also wanted a person to look at the image before it went out, but only when it needed it. With the Shrink to fit option on a template, a very long title is shown in smaller text so that it fits, and in my template a subtitle with no fixed width could run into the author's photo. Once a link is shared on a social media platform, its preview is sometimes cached, so a check beforehand is worth having.
Then I remembered Umbraco Automate. In Automate, a trigger such as a publish starts an automation, which runs a series of actions and can wait for a person to approve. That was what I needed: react to a publish event, check the image for overlapping text and empty template fields, and ask a person to approve it only when something looked wrong. The Codegarden 2026 demo shows it in action.
Writing the custom actions
I wrote two Automate actions on top of the package's services: Check Dynamic Image and Generate Dynamic Image. I call them Check and Generate from here on.
The two custom actions in the Automate action picker, under the Dynamic Images group
Before wiring them up, I changed two settings on my Dynamic Images template. I switched off its On publish toggle, so publishing no longer draws the image by itself, and I swapped the title's Shrink to fit for trimming with an ellipsis after three lines. The trimming is deliberate. A shrunk title leaves nothing for Check to find, but a trimmed one can be detected and flagged.
The template's On publish toggle, switched off
The title layer's Max lines and When it overflows settings
Check Dynamic Image works out where every layer of the template would land on the page, without drawing anything, using the package's MeasureLayoutAsync. It looks for text that was cut short, text running into other text or a photo, and layers that would be missing.
It reports what it found through outcomes, new in Automate 17.6.0. Each outcome becomes its own exit on the automation canvas, so the automation can take a different path depending on the result.
Both actions take a Template alias, which says which template to use. Leave it empty and they use the first enabled one for the page's document type.
I put the two actions together in an automation I called Share image pre-flight. Between them I used two of Automate's built-in actions: Notify Editor shows the warning toast, and Request Approval waits for a person to decide.
The Share image pre-flight automation, with one exit for each outcome of Check
Check has to make sure none of the template's layers run into each other, and overlaps took me the longest to get right. Comparing layout boxes did not work, because the author's name sits in a 960-pixel box whether it says "John Doe" or something three times as long. In the end Check measures each glyph with the same font and wrapping the renderer uses.
The Check Dynamic Image step's settings, with the overlap options highlighted
Once a page has passed Check, Generate Dynamic Image calls the package's RegenerateDocumentAsync, which draws the image, saves it to the page and publishes it.
[Action("dynamicImages.generate", "Generate Dynamic Image", Group = "Dynamic Images")]
public sealed class GenerateDynamicImageAction
: ActionBase<GenerateDynamicImageSettings, GenerateDynamicImageOutput>
{
public override async Task<ActionResult> ExecuteAsync(ActionContext context, CancellationToken cancellationToken)
{
var settings = context.GetSettings<GenerateDynamicImageSettings>();
// ...find the page and its template...
var result = await regeneration.RegenerateDocumentAsync(
contentKey, template, force: true, allowPublish: settings.Publish, cancellationToken: cancellationToken);
// ...pick the outcome from the result...
}
}
With both actions in place, a Content Published trigger starts a run of the automation whenever an editor publishes an article. The Check step measures the image, and if it is clean, the Generate step draws it and saves it to the page a moment later. If something is wrong, the editor gets a toast listing the problems while they still have the page open, and the run waits in the Automation section, under Approvals, until someone decides. Approving sends it on to the Generate step, and rejecting ends the run with the page's old image left alone.
Publishing Santa's article
Let's see it in action. Since this is going out in December, the demo site's author is Santa Claus and I gave the template a Christmas background. I published one of his posts, "Moving the North Pole Gift Tracker to Umbraco 17: Lessons From Six Weeks", with the subtitle "How we moved two million wish lists off a spreadsheet in six weeks". The warning toast popped up:
The warning toast shown to the editor in the open document
The approval was waiting in the Automation section, under Approvals:
The Approvals tab under Automation, listing the request
The approval request, listing the problems the check found, with Reject and Approve buttons
This is the card that would have gone out:
The share image with the subtitle running under Santa's photo
A subtitle running under the author's photo is not something to approve, so I rejected it and nothing was published. I shortened the subtitle to "Two million wish lists, one migration" and published again. This time Check only complained about the trimmed title. The full title is on the page anyway, so I approved it and the run published the image.
The runs list, with the rejected run followed by the completed one
Here is the image it published, with each layer named:
The published share image, with each layer named
Avoiding an infinite loop
Generate publishes the page, which raises Content Published again, and I was braced for an infinite loop. Setting the trigger's When triggered by another automation option to Skip entirely ignores any publish that comes from an automation, custom actions included, so one publish by an editor always gave me exactly one run. It does mean every edit now makes two publishes, and anything else listening to Content Published hears both.
The trigger's setting that skips publishes made by another automation
Bonus: a 24days template
This article is going out on 24 Days in Umbraco, so the repo has a 24days template too, in the 24 Days site's dark blue, purple and green.
The 24days template in the designer
To use it, set Template alias to twentyFourDaysOgImage on both steps.
Run the demo site
Clone the demo repo and run the AutomateDynamicImages.Blog project. On the first launch Umbraco installs itself and seeds the demo data: the articles, the three templates, the fonts and the Share image pre-flight automation.
dotnet run --project AutomateDynamicImages.Blog --launch-profile Umbraco.Web.UI
Open https://localhost:44343/umbraco and log in with admin@example.com and 1234567890. Publish an article and watch the run under the Automation section.
Taking it further
I hope this gives you a few ideas of your own for Umbraco Automate and Dynamic Images. Automate lets you write your own actions, so you can build on what a package already does or turn your own idea into a step.
Thank you to Paul Seal for the package and for letting me loose on it, and to the 24 Days in Umbraco team for the opportunity to share it. Wishing you a wonderful Christmas in advance, and happy automating! 🎄✨