Em português: Corrigindo as prévias do OpenGraph ao compartilhar links no LinkedIn.

Fixing OpenGraph previews on LinkedIn

25/07/2022

Screenshot of an working opengraph preview while sharing a post from this blog on Linkedin.

When I developed this blog, one of my main goals was to have the OpenGraph previews showed correctly in the maximum number of websites possible when some shares a link of a post or a page.

Since I implemented it, the only website I was having problems with it was LinkedIn and I didn't know why. The preview image and page details wasn't being displayed, only the website title.

Nothing seemed wrong on the code at a first glance, but turns out the problem was the <meta> tags having a space between the last attribute and the closing "greater than" character. My guess is that all the other websites parses the tag and removes all the extra spaces when creating preview cards, but not LinkedIn.

I just removed it, and violá! It just worked.

Keep reading...