ampproject / amphtml

The AMP web component framework.
https://amp.dev
Apache License 2.0
14.89k stars 3.89k forks source link

Bluesky embed support #40153

Open jerclarke opened 2 months ago

jerclarke commented 2 months ago

Description

It seems that embeds from Bluesky don't work in AMP.

To my eye, it looks the embed functions similarly to x.com, with a generic blockquote followed by a <script> tag that converts the blockquote.

https://bsky.social/about/blog/post-embeds-guide

AFAIK, AMP supports x.com embeds through a custom script or module or whatever, so I suppose the same would be needed for Bluesky.

I'm creating this ticket because I can't find any reference anywhere to this question, and figured I'd start at the source. Bluesky only seems to have added this embed support in April 2024, so it's very recent.

I am using the amp-wp plugin, but my experience in the past was that support for these weird embeds starts at the top, so I figured I'd start here.

Example code:

<blockquote class="bluesky-embed" data-bluesky-uri="at://did:plc:5x3a6jke5p3ni7mnpd57ijhw/app.bsky.feed.post/3k326ce3fxn2n" data-bluesky-cid="bafyreicmovlmmh7hfcocvj66r73s7u4zz5wfpq225y64asqkwqfblflb54"><p lang="en">Hello 👋🏻 https://globalvoices.org/about/<br><br><a href="https://bsky.app/profile/did:plc:5x3a6jke5p3ni7mnpd57ijhw/post/3k326ce3fxn2n?ref_src=embed">[image or embed]</a></p>&mdash; Global Voices (<a href="https://bsky.app/profile/did:plc:5x3a6jke5p3ni7mnpd57ijhw?ref_src=embed">@globalvoices.bsky.social</a>) <a href="https://bsky.app/profile/did:plc:5x3a6jke5p3ni7mnpd57ijhw/post/3k326ce3fxn2n?ref_src=embed">July 21, 2023 at 9:39 AM</a></blockquote><script async src="https://embed.bsky.app/static/embed.js" charset="utf-8"></script>

Alternatives Considered

If it was an <iframe>-based embed, I'm pretty sure it would just work, but it's not.

I tried it in WordPress both by pasting the code into the HTML editor, and using oEmbed by just pasting the URL. In both cases it worked in my non-AMP version of the site, but not in my legacy AMP template served by the amp-wp plugin.

Screenshot 2024-09-19 at 12 39 29 PM

Additional Context

No response

Siddharthgup commented 1 month ago

Hi @jerclarke, I would like to contribute can u assign this task go me ?

jerclarke commented 1 month ago

@Siddharthgup I have no authority to do anything as far as I know, I'm just a third-degree user of AMP hoping this feature comes to pass.

erwinmombay commented 1 month ago

thanks @jerclarke for opening an issue. This seems pretty easy to implement. We'll triage and look into it

erwinmombay commented 3 weeks ago

@Siddharthgup please feel free to send out a pull request. will be happy to review.