Skip to content

Open Graph: update fallback images to return better images.#7246

Merged
oskosk merged 8 commits intomasterfrom
update/open-graph-fallbacks
Oct 17, 2017
Merged

Open Graph: update fallback images to return better images.#7246
oskosk merged 8 commits intomasterfrom
update/open-graph-fallbacks

Conversation

@jeherve
Copy link
Copy Markdown
Member

@jeherve jeherve commented May 26, 2017

Testing instructions:

Test on a site using Jetpack for its Open Graph Meta tags:

  • Make sure the OG tags, especially the og:image, og:image:width, and og:image:height are always correct on the home page:
    • When only using a Site Icon under Appearance > Customize > Site Identity
    • When using a theme logo when your theme supports it.
  • The images used should always be the largest we have available, not just the minimum size (200x200).

Proposed changelog entry for your changes:

  • Sharing: update Open Graph Image tags appearing on the home page to offer better alternatives based on your site settings in Appearance > Customize.

@jeherve jeherve added [Feature] Sharing Post sharing, sharing buttons [Pri] Normal [Status] Needs Review This PR is ready for review. Enhancement Changes to an existing feature — removing, adding, or changing parts of it labels May 26, 2017
@jeherve jeherve self-assigned this May 26, 2017
@jeherve jeherve requested a review from georgestephanis May 26, 2017 13:27
In #6297, we added transients to cache some of the fallback images in jetpack_og_get_image().
However, transients can only be 45 chars maximum.
To work around that limitation, we now create a 44-char string using md5, based on the image URL.

Also added back changes to Site Icon brought in #6303, and accidentally reverted in #6297.
We're already getting the site icon from the options table anyway, performance should be similar.
Image URL should always be an URL, image sizes should be integers.
* Grab the largest version of the theme logo we have. Facebook likes big images.
* Return width and height values matching the size of the image, not matching the minimum image size we need.
* We want the width and height OG image tags to match the actual width and height of the site icon.
* We want the largest image we have for the Site Icon, it will look better on Facebook.
- We now need a bigger test image, as images smaller than 200 x
200 px will not be used in OG tags.
- We now use `wp_get_attachment_image_src` to grab the bigger version
of the image that we can find.
@jeherve jeherve force-pushed the update/open-graph-fallbacks branch from 5606144 to bcfa67a Compare October 4, 2017 15:03
@jeherve jeherve requested a review from a team as a code owner October 4, 2017 15:03
@jeherve
Copy link
Copy Markdown
Member Author

jeherve commented Oct 4, 2017

I fixed the unit tests. This should now be ready to review.

Copy link
Copy Markdown
Contributor

@zinigor zinigor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the code, tested, tags work fine, LGTM!

@zinigor zinigor added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review This PR is ready for review. labels Oct 5, 2017
Copy link
Copy Markdown
Contributor

@oskosk oskosk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and works great! LGTM

@oskosk oskosk merged commit d6be3cf into master Oct 17, 2017
@oskosk oskosk deleted the update/open-graph-fallbacks branch October 17, 2017 19:24
@oskosk oskosk removed the [Status] Ready to Merge Go ahead, you can push that green button! label Oct 17, 2017
jeherve added a commit that referenced this pull request Oct 18, 2017
jeherve added a commit that referenced this pull request Nov 15, 2017
I added esc_url in #7246, but it seems to be causing encoding issues
with images including special characters and being passed through Photon.

Fixes 1305-gh-jpop-issues
Fixes 1306-gh-jpop-issues
zinigor pushed a commit that referenced this pull request Nov 20, 2017
I added esc_url in #7246, but it seems to be causing encoding issues
with images including special characters and being passed through Photon.

Fixes 1305-gh-jpop-issues
Fixes 1306-gh-jpop-issues
zinigor pushed a commit that referenced this pull request Nov 20, 2017
I added esc_url in #7246, but it seems to be causing encoding issues
with images including special characters and being passed through Photon.

Fixes 1305-gh-jpop-issues
Fixes 1306-gh-jpop-issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Feature] Sharing Post sharing, sharing buttons [Pri] Normal Touches WP.com Files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants