Commit fe31e07
Open Graph Meta Tags: add new fallback image (#44336)
* Open Graph: add new fallback image
Fixes CML-608
This leverages the Social Image Generator library to dynamically generate a better social preview image for sites, based off any image we can find from the site (using the same logic as before), but framing that image and display the site title so the whole preview looks better.
This is currently not something that can be customized via a UI yet.
- It uses the `edge` template from Social Media Generator because it seems to be the template that best fits social previews.
- The `jetpack_og_fallback_social_image_template` filter allows one to define their own template instead.
- If the Social Image Generator features are not available, we fall back to the previous behavior.
- The dynamically generated image src is stored in a transient for a day, to avoid putting too much strain on the service.
* Avoid overcaching with the transient
Give the transient a more specific name so it can get flushed when the source of the image changes.
* Better defaults
* Fix fallback when dynamic generation does not work
* Add test for jetpack_og_get_site_fallback_blank_image
* Add tests for jetpack_og_get_site_image
* Extract SIG functionality into separate functions with filters
That should make for easier testing
* Add some tests for jetpack_og_generate_fallback_social_image
* Only cache the token, with a more unique key
This will avoid conflicts when a site's representative image is updated
* Only cache successful responses
* Be more specific when removing filter
See Automattic/jetpack#44336 (comment)
* Add missing $ in pattern
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Add missing space
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Add missing @SInCE
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Use wp_hash instead of md5
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/16522277642
Upstream-Ref: Automattic/jetpack@ad771641 parent 63888ed commit fe31e07
2 files changed
Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments