Automattic / jetpack

Security, performance, marketing, and design tools — Jetpack is made by WordPress experts to make WP sites safer and faster, and help you grow your traffic.
https://jetpack.com/
Other
1.57k stars 797 forks source link

Pinterest sharing button fails to retrieve an image #14542

Open chvillanuevap opened 4 years ago

chvillanuevap commented 4 years ago

Steps to reproduce the issue

  1. Go to https://thepostmansknock.com/incredible-bullet-journal-ideas-examples/
  2. Click on the AMP Pinterest sharing button under the title and excerpt.
  3. See that the Pinterest pop-up window does not pull up an image to share.

What I expected

I expected an image to be pulled up to share.

What happened instead

No image is displayed for the user to pin.

The Pinterest AMP button needs a data-param-media attribute to pull up an image (see https://amp.dev/documentation/components/amp-social-share/#pre-configured-providers). I think the plugin should offer a filter in the function render_sharing_html in jetpack/3rd-party/class.jetpack-amp-support.php for users to be able to add more parameters to the social share buttons.

chvillanuevap commented 4 years ago

Adding these parameters to the $supported_services variable fixes my problem:

$supported_services = array(
    ...
        // added these parameters myself based on https://amp.dev/documentation/components/amp-social-share/#pre-configured-providers
    'pinterest' => array(
        'data-param-media' => $pinterest_thumb_url,
        'data-param-url' => get_permalink( $post->ID ),
        'data-param-description' => $post->post_title,
    ),
    ...
);