Og:image and Twitter Card Image Generator

Hey guys!
I am surprised that I can’t anything about tcardgen :astonished:

Generate Twitter card (OGP) images for your blog posts. Supported front-matters are title, author, categories, tags, and date. Also, both toml and yaml formats are supported.

Is there an easier way to generate images for og:image based on variables from *.md of posts?
I want to generate those on my own variables

We use Cloudinary to serve our OG images. For adding text and layering our logo on top we use a combination of these:

By substituting part of the Cloudinary URL with Hugo variables from our markdown files, we get custom OG images for each content page!

1 Like

https://discourse.gohugo.io/t/approaches-for-dynamically-creating-opengraph-images/40614/5

Still trying to figure out a way to control how the .Text filter breaks lines — specifically, how to tell it to do either of the following:

  • Respect any non-breaking spaces in the .Title. (Tried to feed it formatted text but, of course, it works with only a string.)
  • Failing that, make sure that the last line of .Title is at least two words.

Otherwise, I can end up with text that looks like this (simulating):

This is my extra-long title
with a really short word at the
end

Perhaps a future update will allow .Text to accept HTML. One can hope. :thinking: