Closed JanPetterMG closed 7 years ago
The type returned by Embed may not be the type returned by opengraph. This is a decision made for simplicity. If there's no embed code, it's considered as a link (no mather if the link is an article, a new, event, etc). If there's embed code, it can return a video, photo and, if it's none of them, rich.
If you want to get the exact value returned by opengraph, just use the opengraph provider:
$oembed = $info->getProviders()['opengraph'];
$type = $opengraph->bag->get('type');
Conclusion:
The opengraph
provider is mainly made for internal Embed usage only. Anyone looking for a native provider, should use the html
provider only!
Why is
og:type
=article
replaced withlink
in theOpenGraph
class?Source: The Open Graph protocol - http://ogp.me/
So If I'm checking the
og:type
, and it saysvideo
, then I'll naturally want to check all thevideo:*
properties, similarly also forimage
. But forarticle
, why is it replaced withlink
? How do I know this is an article and therefore want to parse thearticle:*
properties?About 3% of the time
link
is returned, it's actually anarticle
, so why I'm I parsing the other 97% for no reason, when I'm only interested in articles?