Og-Sample
I’m making an effort to make my og [1] images better yet again, I’m going for that
next 10% better. I really like my og images, but there are some title sizes
that overflow. This page is a page to help debug. How I make these og images
is for another day.
Script # [2]
I use my own static site generator markata [3]. I can use it to generate a
list of posts wrapped in their og image. I use itertools to do a groupby so
that I can do roughly every 5 characters larger, and see a wide variety of
sizes.
from markata import Markata
from itertools import groupby
markata = Markata()
lens = [{'length': len(post.title), 'title': post.title, 'slug': post.slug} for post in m.posts]
lens_sorted = sorted(lens, key=lambda x: x["length"])
groups = {
k: list(g)
for k, g in groupby(lens_sorted, key=lambda x: (x["length"] // 5) * 5)
}
posts = [g[0] for g in groups.values()]
ogs = [ f'[![{post["title"]}](https://shots.waylonwalker.com/shot/?url=https://waylonwalker.com/{ post["slug"] }/og/&height...