• Resolved MegaZ

    (@megaz)


    Ever since the last update to Jetpack related posts, all of my related posts are showing duplicate entries.

    The commit that caused this is the following:
    https://github.com/Automattic/jetpack/commit/04fbdf4430dce0c6c41ad390b6fbaaf3b3911ba8

    Specifically, the below lines of code:

    – wp_enqueue_script( ‘jetpack_related-posts’, plugins_url( ‘related-posts.js’, __FILE__ ), $dependencies, self::VERSION );
    + wp_enqueue_script(
    + ‘jetpack_related-posts’,
    + Jetpack::get_file_url_for_environment(
    + ‘_inc/build/related-posts/related-posts.min.js’,
    + ‘modules/related-posts/related-posts.js’
    + ),
    + $dependencies,
    + self::VERSION
    + );

    If I remove the commit and roll back to the single line wp_enqueue_script, the problem goes away. I suspect the script is somehow loading twice and causing related posts to show up twice.

    In essence, “jp-relatedposts-items” is being reproduced twice. I manually rolled back the change and it works for now, but I would appreciate a long term solution so that I don’t have to deal with this with each Jetpack update.

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi,

    Thanks for your details.

    However, my testing with the latest version of Jetpack 5.7.1 is still displaying correctly.

    Could you please post your site URL here, so I can have a look?

    If you want it to remain private, you can also contact us via this contact form:

    https://jetpack.com/contact-support/?rel=support

    Thanks!

    Thread Starter MegaZ

    (@megaz)

    Dat, I found the issue – it was because I was minifying the related-posts.js file and it was loading on every page, even though the new script was pushing for the minified related-posts.min.js version. This caused the script to run twice and hence show double results. As soon as I removed related-posts.js and replaced it with related-posts.min.js in the minification of W3TC, the issue went away.

    Thanks for looking into this!

    Hi,

    Ah, that makes sense. Thanks for updating us.

    Please open a new topic if you have any other issues with Jetpack.
    https://www.ads-software.com/support/plugin/jetpack#new-post

    Have a great day!

    Cheers, Dat

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Jetpack Related Posts – Duplicate Entries’ is closed to new replies.