BeaconCMS/beacon

Page Builder: Component to load embedded resources (oEmbed)

leandrocp opened this issue · 5 comments

Add a new component embed/1 into https://github.com/BeaconCMS/beacon/blob/main/lib/beacon_web/components/components.ex that takes an URL, unfurl such resource, and render the html property.

For example, given that someone adds the following snippet into a page template:

<BeaconWeb.Components.embed url="https://www.youtube.com/watch?v=giYbq4HmfGA">

The resulting markup should look like:

<iframe width=\"200\" height=\"113\" src=\"https://www.youtube.com/embed/giYbq4HmfGA?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen title=\"ElixirConf 2023 - José Valim - The foundations of the Elixir type system\"></iframe>

See https://oembed.com/

Using a library like https://hex.pm/packages/oembed helps to parse the many available providers.

Hey! I created a PR for this issue:
#389

Hi @edborsa I guess you meant that PR #389 is to solve the issue #357? :)

A PR for this issue is also very welcome. AFAIK @APB9785 haven't started working on this one yet.

That's right, I have not yet started on this.

Oh, cool!
I'll tackle this next then ;)

Correct PR #391