Skip to content

2.1 Beta 2

Pre-release
Pre-release
Compare
Choose a tag to compare
@westonruter westonruter released this 15 Apr 06:39
· 6048 commits to develop since this release
1e7ea02

This is the second beta prerelease for v2.1, after the first beta a few weeks ago. For the full list of changes coming in this release, please see the 2.1 milestone.

On top of the changes in the first beta, this prerelease includes 8 closed issues and 12 merged pull requests (excluding dependency updates). Please report any issues you encounter while testing! The 2.1 stable release is due out this month (April).

The key changes since the first beta include:

  • Improve hero image determination. The first beta included a DetermineHeroImages transformer which automatically identified the custom logo, header image, featured image, and content-initial cover/image blocks. However, it was only enabled by default for core themes since there were known cases where it failed to properly identify hero images, erroneously causing some images outside of the initial viewport to be prerendered. These issues have been fixed and the transformer is now enabled by default. A new HeroCandidateFiltering service uses filters to inject the data-hero-candidate attribute into the custom logo and custom header images as well as in the attachment image which is the featured image for the first post in the main query. If these filters missed identifying a hero image candidate, then the DetermineHeroImages transformer will mark all non-lazy loaded images which occur before the main element (or the first .entry-content) as hero image candidates. Additionally, when the original img had loading=lazy this is now preserved on the prerendered image which mitigates the risk of accidentally marking an image out of the first viewport as a hero image. Lastly, beyond just considering the content-initial Cover block and Image block, now any image appearing as a descendant of the first content element will be considered as a hero. Note that currently only two images get identified as heroes for prerendering (but see ampproject/amp-toolbox-php#55 (comment)). If you want to have total control over which images are designated as heroes, you can add the data-hero attribute yourself. (#6062, #6061, ampproject/amp-toolbox-php#141, ampproject/amp-toolbox-php#149, ampproject/amp-toolbox-php#144, ampproject/amp-toolbox-php#141, ampproject/amp-toolbox-php#136, ampproject/amp-toolbox-php#135, ampproject/amp-toolbox-php#115)
  • Serve AMP scripts as ES modules to modern browsers. The RewriteAmpUrls optimizer transformer was ported to amp-toolbox-php. This transformer rewrites AMP script tags to use type=module for supporting browsers. These scripts are comprised of ES modules which reduce the overall amount of code since polyfills for older browsers are omitted. Support for older browsers remains by serving the original AMP scripts with nomodule. This transformer also allows opting-in to the LTS versions of AMP scripts (cf. #4600). Additional changes will facilitate script self-hosting in a future release. (#6037, ampproject/amp-toolbox-php#140, ampproject/amp-toolbox-php#130, ampproject/amp-toolbox-php#122)
  • Introduce AMP status panel to document sidebar and pre-publish checks. To improve visibility of AMP validation issues in the block editor when developer tools are enabled, the “Enable AMP” toggle has been moved to a new AMP panel in the document sidebar. This panel now includes the validation status message and a button to take you to the AMP Validation sidebar. This same panel is also now presented in the pre-publish checks. (#5997, #6027, #6022)
  • Add wp amp optimizer WP-CLI command. (Experimental) The AMP Optimizer from amp-toolbox-php is bundled with the AMP plugin and its CLI interface is now accessible via WP-CLI. New commands include wp amp optimizer optimize, wp amp optimizer transformer list, and wp amp optimizer transformer config. See pull request for details. (#6053, #6063, #6064, #6065, ampproject/amp-toolbox-php#150, ampproject/amp-toolbox-php#92, ampproject/amp-toolbox-php#139)
  • Inherit object-fit and object-position styles. In the past when your theme used object-fit/object-position style properties on images and videos they would not show up on AMP pages when the img and video elements were converted into amp-img and amp-video respectively. This required having to add additional AMP-specific styling. This is no longer the case as the img and video elements that AMP creates inside of amp-img and amp-video now have default styling to inherit these style properties. This also applies to the noscript fallback images/videos. Special support for core themes and the Cover block were able to be removed, and cases in other themes/plugins should now more often work out of the box. The overall CSS is also reduced. (#5955, #6028)

The amp-toolbox-php package was updated to include changes from the 0.3.0 and 0.4.0 releases. Again, for all changes see issues and PRs closed since 2.1-beta1.

Installation

You can also install the amp.zip build linked below by uploading it in the WordPress admin.

For up-to-the-minute builds, see the Development Builds Wiki page.