Automattic / pym-shortcode

A WordPress solution to embed iframes that are responsive horizontally and vertically using the NPR Visuals Team's https://blog.apps.npr.org/pym.js/
https://wordpress.org/plugins/pym-shortcode/
GNU General Public License v2.0
14 stars 7 forks source link

AMP support? #59

Closed benlk closed 4 years ago

benlk commented 5 years ago

Fallback cases where Pym.js fails to load in the parent

For shortcodes:

For blocks:

Specific to AMP

For whatever WordPress AMP plugins we want to support:

benlk commented 5 years ago

https://amp-wp.org/documentation/playbooks/custom-shortcodes-and-widgets/ describes the function is_amp_endpoint() and amp_is_canonical() which we might use with some of the filters added recently to change the output embed code on the page. However, AMP iframe tags aren't 100% compatible with Pym; they use a different postMessage syntax. We'd need to link out to AMP's docs for how to initialize using the amp iframe code versus Pym.js, and we'd need to make these tests ourselves.

philipjohn commented 5 years ago

There's some discussion going on about this in the AMP Project

claudiulodro commented 5 years ago

I have a proposed "good-enough" solution for this at https://github.com/Automattic/newspack-plugin/pull/276. Let me know if you want it in this plugin and I'll open a PR here. I'd definitely prefer to contribute it upstream to this plugin instead of maintaining it as a tweak in Newspack.

benlk commented 5 years ago

@claudiulodro Yes, we'd love to have your PR here.

claudiulodro commented 5 years ago

https://github.com/INN/pym-shortcode/pull/62

benlk commented 5 years ago

Thanks! We'll take a look as soon as we can.