Open TimBroddin opened 1 year ago
The core already has an API for parsing the site metadata. Currently, it's used to generate URL details popups. We can probably adopt that into an embed provider.
I started experimenting with a similar concept a few years ago - https://wordpress.org/plugins/bookmark-card/.
@Mamaduka thanks for linking to your plugin. It does exactly what I'm talking about.
It would be such an improvement to the UX if we could bring something like that to core.
There is a open PR https://github.com/WordPress/gutenberg/pull/47765 to add card link.
What problem does this address?
Currently when pasting a link that doesn't support oEmbed embedding, an error is shown, and the option to convert to a normal link is proposed
What is your proposed solution?
I like the way Medium handles this. It fetches the OpenGraph tags and makes a nice card.
Right now the embed block calls the oEmbed endpoint (
/wp-json/oembed/1.0/proxy
). It would make sense to call another API endpoint (for example/wp-json/opengraph/1.0/proxy
) when this fails, which would return the relevant OpenGraph tags (title, description, image) needed to build the card.