Twitter Embed Breaks AMP
-
Looks like the twitter embed breaks AMP pages due to a leftover empty <script></script> tag set.
This doesn’t occur when just using the regular WP embed. Is it not possible to NOT have this plugin take over embeds that WordPress can already handle? I just wanted it for the stuff that WordPress doesn’t do.
I’ve had to disable it for the time being as valid AMP pages are more important.
-
Thanks for reporting that @jpeek and sorry for the bug. We’ll have a fix out very shortly.
PublishPress Embeds should default to normal WP embeds, but we made a small typo there.
Awesome, I’ll keep an eye out for the update and the patch notes 🙂
Hi @jpeek,
I wasn’t able to reproduce the issue. Please, could you describe the steps to reproduce that? What plugin have you used for AMP?
Please, could you check and describe where is the empty “script” tag being printed? Please, could you send a copy of the output or a screenshot?
Looking forward to helping,
Thanks
I’m using the AMP plugin by Automattic. It’s possible that it’s their fault, but it doesn’t happen when using the regular WP twitter embed, hence my post here 🙂
I don’t have a live example, but here’s a screenshot and the resulting html including the empty script tag that causes the problem:
<div class="embedpress-wrapper ose-twitter ose-uid-b504b2195d3bc35403bba20fe64694cc responsive"> <blockquote class="twitter-tweet" data-width="550"> <p lang="en" dir="ltr">Guardians rejoice! Get your hands on some exotic loot with our official <a href="https://twitter.com/hashtag/Destiny2?src=hash">#Destiny2</a> range: <a href="https://t.co/FH7C2Tk1cI">https://t.co/FH7C2Tk1cI</a> <a href="https://t.co/WErZb3jwpl">pic.twitter.com/WErZb3jwpl</a></p> — Numskull Designs (@NumskullDesigns) <a href="https://twitter.com/NumskullDesigns/status/895689826686689280">August 10, 2017</a> </blockquote> <script></script> </div>Just noticed that this also happens with Reddit embeds. Again, this may very well be a shortcoming of the AMP plugin but…
Thanks for such useful feedback, @jpeek. We’ll get a fix out ASAP
Hi @jpeek,
We worked on a fix for the issue with the AMP plugin and Twitter and Reddit embeds.
Please, could you try the following package?
http://packages-tmp.s3.amazonaws.com/52c6a5be5b3fc31e7d444e387dbac2d5/embedpress-2.0.1a1.zip
Please, let us know if the issue is fixed.
Looking forward to helping
Been a while since I looked at this more closely and for some reason things seem to be working over the past few months. I *think* I made a tweak to the AMP plugin to work around the issue but…
anyway… tried out the new version and got the following error:
Fatal error: Class name must be a valid object or a string in […]\wp-content\plugins\embedpress\EmbedPress\AMP\EmbedHandler.php on line 47
Hi @jpeek,
Alright, sorry about that. Please, could you try this new package?
http://packages-tmp.s3.amazonaws.com/76ce856dc4a1cdd1ef6b57f6d52fcacf/embedpress-2.0.1a2.zip
Thanks,
That seems to work. Looks like the tweet is embedding nicely now and I’ve validated the page source for AMP compliance and it passed.
To follow up, I did notice that the Reddit embed in the AMP version has a lot of additional padding at the bottom for some reason.
Hi @jpeek,
Thank you for confirming the fix and for reporting the new issue.
We will take a look on it.Thanks
Hi @jpeek,
We have a new alfa package addressing the issue you reported on Reddit.
http://packages-tmp.s3.amazonaws.com/ef1f687fa3862a12fdb4e7eda535ea1a/embedpress-2.0.1a4.zip
But unfortunately, it requires manually adjust the size on each embed. Reddit returns different sizes according to each content, and the OEmbed API doesn’t return the current size. Since it is inside an iframe, we can’t manipulate that. By default, each embed has a squared proportion of 1:1. You can edit the embed and set a custom size (which will make it calculate the correct proportion).
Please, let us know if that helps.
Kind regards,
Thanks, that seems to work. Not ideal but it does the job 🙂
On an unrelated note, I noticed the following error when embedding an Instagram post. The post still embeds nicely, but the warning is displayed at the top of the content.
Warning: Attempt to assign property of non-object in ….\wp-content\plugins\embedpress\EmbedPress\Shortcode.php on line 138
The topic ‘Twitter Embed Breaks AMP’ is closed to new replies.