• Resolved thinkero

    (@thinkero)


    I’m looking for a solution to remove the multiple load of youtube base.js script when I use multiple Jetpack Youtube shortcodes on the same page.

    The function youtube_id generates multiple iframes and base.js from Youtube is requested for many times generating pagespeed issues.

    Any suggestions? Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Dan (a11n)

    (@drawmyface)

    Hi there

    Have you tried embedding the videos using the URL only, without the shortcode? Do you see the same issue?

    I wasn’t able to reproduce this issue in testing. Could you provide any more details, or could you please post your site URL here so that we can have a look?

    If you want it to remain private, you can also contact us via this contact form. If you choose to reach out directly, please include a link to this thread.

    Thanks!

    Thread Starter thinkero

    (@thinkero)

    Hi,

    All youtube videos are stored in post_content as shortcodes [youtube https://www.youtube.com/watch?v=XXX ] parsed by wordpress or manual placed via metafields with youtube_id( $v_videourl).

    If there were multiple youtube shortcodes in articles, I saw multiple instances of base.js in pagespeed analysis, but I think I solved it by placing loading=’lazy’ in
    <iframe loading='lazy' class='youtube-player' width='$w' height='$h' {$layout}src='" . esc_url( $src ) . "' allowfullscreen='true' style='border:0;' sandbox='allow-scripts allow-same-origin allow-popups allow-presentation'></iframe>
    in modules/shortcodes/youtube.php

    I’m looking to make something similar with your placeholder from amp-youtube, to place the youtube thumbnail as a facade and then to replace it after js is loaded.

    • This reply was modified 3 years, 9 months ago by thinkero.
    Plugin Contributor Dan (a11n)

    (@drawmyface)

    I’m looking to make something similar with your placeholder from amp-youtube, to place the youtube thumbnail as a facade and then to replace it after js is loaded.

    I’m afraid that’s beyond the scope of the support we can provide here. If you’d like to suggest it as an enhancement to an existing Jetpack feature, you can add that on our public Github repository:
    https://github.com/Automattic/jetpack/issues

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Multiple load of youtube base.js via shortcodes’ is closed to new replies.