Search code examples
share-open-graph

opengraph meta data not working properly for LinkedIn regardless of Post Inspector


There seems to be something odd in OG metadata in our website and I can't figure out what it is...

For example this page: https://en.ilmatieteenlaitos.fi/wind-energy.

Has og:image and og:title (there is some extra stuff, but they shouldn't matter) <meta data-n-head="ssr" data-hid="og:image" property="og:image" content="https://images.ctfassets.net/hli0qi7fbbos/7aa7VLl18PM8amWiILgeCH/30be16653881211492963375de425d7b/Tuulivoimalat_Hamina_ilta_SariHartonen.jpg"> <meta data-n-head="ssr" data-hid="og:title" property="og:title" content="Wind energy - Finnish Meteorological Institute">

Previews show correctly in here: https://www.opengraph.xyz/url/https%3A%2F%2Fen.ilmatieteenlaitos.fi%2Fwind-energy/

Post Inspector shows preview incorrectly just like sharing the page in Linkedin app: https://www.linkedin.com/post-inspector/inspect/https:%2F%2Fen.ilmatieteenlaitos.fi%2Fwind-energy. Using inspector should refresh the cache, but it's not doing it.

I tested with a test page (https://cdn.fmi.fi/demos/stackoverflow/some) in different domain with same header and all worked just fine with inspector and app and everything.

Is the problem deeper in en.ilmatieteenlaitos.fi -settings since all worked fine in cdn.fmi.fi?

edit: did more testing on our beta-site so content of the page is same as in production. All worked just fine in beta-site. So my guess there is something wrong in production website's settings which is out of my comprehension. Any tips? :) We are using Contentful and AWS...


Solution

  • I believe the problem is oq:url. Currently it's always set to our website's mainpage. Maybe Linkedin caches stuff based on that so all shares get the same cached result. This is not the case for twitter. Not sure about other some-platforms.

    I also added prefix="og: https://ogp.me/ns# to html-element's attributes. Not sure how much difference this makes.

    Now Linkedin shares seem to work in our preproduction site which uses same data as production.