Opened 2 years ago
Closed 7 months ago
#6617 closed enhancement (fixed)
Replace plugin page banner markup
Reported by: | jonoaldersonwp | Owned by: | dufresnesteven |
---|---|---|---|
Milestone: | Priority: | low | |
Component: | Plugin Directory | Keywords: | performance seo |
Cc: |
Description (last modified by )
The hero banner image on plugin pages uses suboptimal markup, which has a negative impact on performance and SEO. The following minor changes should significantly benefit end-users.
- Remove the inline
<style>
tag (which sets the image as the background of the banner container). - Remove all styling applied to
.plugin-banner
, except for the existing margin attribute(s). - Add CSS targeting
.plugin-banner img
to setobject-fit: cover; width: 100%;
- Add an
<img>
inside.plugin-banner
, using the markup below.
Image markup
<img decoding="async" fetchpriority="high" src="%path-to-image%" width="930" height="304">
When a 1544x500
version is available, add a srcset
attribute, to produce a result as follows:
<img decoding="async" fetchpriority="high" srcset="%path-to-2x-image% 2x" src="%path-to-image%" width="930" height="304">
Change History (10)
#5
@
2 years ago
Ah, interesting!
We can do something similar here, I think, and just move the background into an <img>
el in the existing structure.
- Remove the inline
<style>
tag (which sets the image as the background of#plugin-information-title.with-banner
). - Add CSS targeting
.vignette > img
to setmin-width: 100%; object-fit: cover; object-position: top center;
. - Add an
<img>
inside.vignette
, using the markup below.
Image markup
<img decoding="async" fetchpriority="high" src="%path-to-image%" width="755" height="250">
When a 1544x500 version is available, add a srcset
attribute, to produce a result as follows:
<img decoding="async" fetchpriority="high" srcset="%path-to-2x-image% 2x" src="%path-to-image%" width="755" height="250">
This ticket was mentioned in Slack in #meta by tellyworth. View the logs.
2 years ago
This ticket was mentioned in Slack in #meta by dufresnesteven. View the logs.
7 months ago
#8
@
7 months ago
I've added some of these changes for https://meta.trac.wordpress.org/ticket/7620.
I'm assuming we want to provide a specific width and height, correct?
FWIW I think the existing markup choice was due to the previous design where the Plugin Name text was overlaid on the image.
Can you validate the HMTL returned through the API and displayed within the iframe inside WordPress for plugin details too? That still uses the text-overlay design it appears. Ie.
wp-admin/plugin-install.php?tab=plugin-information&plugin=wordpress-seo
.Edit: Core hard-codes it, it's not from the API. https://github.com/WordPress/wordpress-develop/blob/ec1110c719252c69559c7d3b5709a6dc914fd27b/src/wp-admin/includes/plugin-install.php#L616-L632