-
Notifications
You must be signed in to change notification settings - Fork 800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AMP: Render amp-gist from gist shortcode/oEmbed during AMP requests #10053
Conversation
That's a great PR description, thank you so much for your effort! Generated by 🚫 dangerJS |
Do you think you could move most of this to the existing AMP compatibility file, to keep things in one place? It may also be useful to have unit tests for this, as introducing new regex in shortcodes has already bitten us in the past :) |
I think it would be harder to maintain if the AMP code is disconnected from the modules' non-AMP code. You're right about this needing unit tests. I'll try to add some. |
@jeherve It seems there aren't any tests for the Gist shortcode/oEmbed yet. Is that right? I'd rather not start from scratch. |
Temporary Jetpack extension which can be used until this is part of a release: https://gist.github.com/westonruter/8c91e3a218eeb1403ce2eacb832c0783 |
You're right, I thought we had some. I will add a first set of tests in #10127. |
This is true. Let's keep that code here. That said, I think it would be useful to create a new method such as Does that make sense? Do you think you could add that in until the unit tests get merged? Thank you! |
Yes, that makes sense to me! It doesn't matter to me where the However, there are some changes need to be made to the code in return function_exists( 'is_amp_endpoint' ) && is_amp_endpoint(); The reason why This will mean that Jetpack will need updated in places such as this: jetpack/3rd-party/class.jetpack-amp-support.php Lines 49 to 50 in 05ebb6c
So all of this to say: when In the mean time, I can add unit tests for |
Thanks for all the details; that makes perfect sense! I'll let you know once the Unit Tests are in. |
Unit tests have been merged. |
@jeherve tests have been added. |
I'm having trouble testing this. Using my own gist or directly using the snippet above with this branch, tested on the stable AMP plugin (q: do I need a beta version of AMP 1.0?) No console errors. Validates as valid AMP. It produces |
@kraftbj I just checked on the 0.7.2 release and 1.0-beta4 alike and both are working for me. Is your test environment on HTTPS? That is required. |
False alarm @westonruter — something was weird with pulling down our beta server's built version of the branch. On desktop Chrome, everything looks as expected. For kicks, in Firefox Dev on desktop, as more items are embedded, it begins to cut off the ends of the embed. Notice how the gists start complete, then slowly the height is reduced until it fully loses the footer, plus some: I'm open to accepting this with that defect present given the normal usage of AMP and it is somewhat a corner case, but want to get your thoughts on where the issue may be with it. |
@kraftbj Interesting. I think you've identified a bug with the |
Thanks @westonruter! That makes sense. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works for me. Thank you! Merging.
Changes proposed in this Pull Request:
amp-gist
from agist
shortcode or oEmbed when in an AMP response.Testing instructions:
gist
shortcode or gist oEmbed URL to a post. Then view that post in AMP.Example content:
Originally proposed in ampproject/amp-wp#375
See also ampproject/amphtml#17738 for details on the
amp-gist
'sheight
attribute.Proposed changelog entry for your changes: