Releases: ampproject/amp-wp
2.0.0-beta1
Update: 2.0.0-beta2 is now available.
We are very excited about the upcoming v2.0 release of the official AMP plugin for WordPress! Lots of work went into this release, and it is loaded with many improvements and new capabilities in the areas of usability, performance, and flexibility. Originally this was going to be v1.6 but due the major changes we decided it warranted a major version bump.
This is the first beta release for v2.0. For the full list of changes in this release, please see the 2.0 milestone, with 85 closed issues and 95 merged pull requests (so far). Please report any issues you encounter while testing! The stable release is scheduled for August 15th.
The key highlighted features in this release include:
- Expanded Reader Mode with full-site coverage (rather than being limited to singular posts and pages as in legacy Reader mode), template and design variations from selecting alternate themes to better match your site's brand, and support for standard WordPress features like nav menus, custom logo, and commenting.
- Onboarding Wizard and revamped Settings Screen which make configuring the plugin more intuitive, explaining the three template modes (Standard, Transitional, Reader), and indicating which may work best for the site and for the user's technical ability.
- Plugin Suppression to provide administrators with a new option for how to deal with plugins that cause validation errors by turning off select plugins during when generating AMP pages.
- Mobile Redirection to facilitate sites in Transitional/Reader modes where AMP intended to be used as the mobile version of the site.
- Improved Developer Tools allowing validation to be turned off for users who don't want it and improving validation workflow for users who do.
Read on for the full details.
Changelog
Expanded Reader Mode
Reader mode now allows for any AMP-compatible theme to be used to serve AMP pages, rather than just the legacy post templates. This allows for long-requested features including nav menus, logos, commenting, and template design variations. It also makes it possible to serve all URLs of a Reader-mode site in AMP, as opposed to just singular posts. The old Reader mode AMP post templates are still available as a "Legacy" theme which is not going away, but it remains limited to serving AMP for singular posts.
To recap the modes: in Standard mode, there is one theme and one version of the site; Standard mode is AMP-first, where there are no AMP-specific URLs as AMP is the canonical (and only) version of the site. In Transitional mode, there is still one theme but there are two versions of the site, where each canonical non-AMP URL may have a separate paired AMP version. Reader mode takes this a step further: the site has two themes, and the active theme is used for canonical non-AMP URLs and the Reader theme is used for AMP URLs. The Standard mode is the recommended mode since it means desktop and mobile visitors both get the speed benefits of AMP and there is less to maintain with only one version/theme on the site. Reader mode is a good choice when the active theme is not AMP-compatible and thus not suitable for Standard or Transitional. Transitional is useful in cases where a partially AMP-compatible theme is used, and the user either wants to do development to make the site fully AMP compatible (i.e. transition to AMP-first), or simply wants a simpler setup.
If at any time the active theme is switched to be the same as the one selected for Reader mode, then the plugin automatically switches from Reader mode to Transitional mode. This is because the site now will behave as if Transitional mode was selected since Reader mode involves two separate themes being used.
The paired browsing feature of the plugin remains limited to sites in Transitional mode, as it doesn't make much sense to see the AMP and non-AMP versions side-by-side if two different themes are being used.
When serving an AMP page with the theme selected in the new Reader mode (i.e. non Legacy), all of the standard WordPress theme hooks are used to extend the templates. So to add something to the footer, use the wp_footer
action instead of amp_post_template_footer
. Actions prefixed with amp_post_template_*
are limited to the legacy Reader theme templates. To know which version should be used in a given site, use current_theme_supports('amp')
which will return true if an AMP page must be served without the legacy theme.
AMP Customizer for Reader Mode
When a Reader theme is selected, there will then be two versions of the Customizer available: the default Customizer for the active theme, and the AMP Customizer for the AMP Reader theme. Since in Standard and Transitional modes only one theme is used, only one version of the Customizer will be used. The AMP Customizer can be accessed via the Customize link in the admin bar on an AMP page, or via the admin menu, or via the AMP settings screen. The fact the Customizer is currently editing the AMP version of the site is clearly displayed, along with a link to switch to the main non-AMP Customizer. The AMP Customizer opens with the “Tablet” device being selected for preview by default; this viewport corresponds to the screen size of modern smartphones and it doesn't make sense to default to preview the Desktop viewport size since the vast majority of visitors to AMP pages will be on mobile devices when Reader mode (or Transitional mode) is enabled.
In the AMP Customizer, you can assign the same nav menus used in your active theme to nav menu locations used in the Reader theme. As of #5039 there will also be the ability to copy the theme modifications from the active theme over to the Reader theme so you can preview and tweak how the logo, background color, header, and other settings look in the Reader theme prior to publishing. Any Customizer control for general site options (like the Site Title) include a notification indicating they also apply to the non-AMP version of the site. The Additional CSS section of the Customizer allows you to tweak the styles of the Reader theme separately from the Additional CSS modifying the styles of the active theme. Note that widgets are not supported on AMP pages with a Reader theme, so the Widgets panel of the AMP Customizer is removed. The Homepage Settings section is also removed since it exclusively contains global site options that are not specific to the AMP version of the site. The Themes panel is also removed in the AMP Customizer; switching Reader themes currently must be done from the AMP settings screen.
When the “Legacy” Reader theme is selected, there is only a single version of the Customizer is available; the AMP panel in the Customizer here remains for making changes to the appearance of the legacy post templates.
Non-AMP Customizer | AMP Customizer for Reader theme |
---|---|
Initialization in Reader Mode
When a Reader theme is selected, a request for an AMP page will cause the Reader theme to be loaded instead of the active theme. This is using the same logic the Customizer uses to switch themes during preview. An important implication of this is that if you have custom post types, taxonomies, blocks, or shortcodes—these must be registered in plugins instead of your theme in order for them to be available on AMP pages. It is already a best practice to do such registration in plugins, but WordPress does not enforce it. The plugin will soon also provide a theme scanning capability which will detect whether the active theme is doing any such registrations in order to warn you before activating a Reader theme (see #4795).
Loading a Reader theme on an AMP request happens at the plugins_loaded
action (at priority 9). The Reader theme is loaded this early to ensure it can be accessed in the Customizer and that all of the theme's functionality can be initialized properly. If you customize the query param used for AMP URLs to be different from the default of amp
(via the amp_query_var
filter) then you must do this in a plugin before this plugins_loaded
action occurs. Otherwise, you will not be able to select a Reader theme other than Legacy. Reader themes require the use of a URL query param (e.g. ?amp=1
) as opposed to an endpoint (e.g. /amp/
), though we intend to improve the customization of this in the future (see #2204).
Adding Reader Themes
By default any of the core themes may be selected for Reader mode (except for the non-responsive Twenty Ten). The plugin will likely add more AMP-compatible ecosystem themes to the default list in the future, but if you'd like to include a custom AMP-compatible theme to the list there is a filter to do so, for example:
add_filter( 'amp_reader_themes', function ( $reader_themes ) {
$reader_themes[] = [
'name' => 'Neve',
'slug' => 'neve',
'preview_url' => 'https://wp-themes.com/neve',
'screenshot_url' => 'https://i0.wp.com/themes.svn.wordpress.org/neve/2.7.5/screenshot.png?...
1.5.5
This is the fifth patch release for the 1.5 branch following the v1.5.4 release. The v1.5.5 milestone includes two improvements:
- Optimize
AMP_Tag_And_Attribute_Sanitizer::get_missing_mandatory_attributes()
. Based on the Blackfire analysis that @schlessera performed, this fixes a bottleneck that can increase performance generating AMP pages by 3x! #4991 - Add
amp-state
to list of allowed URL protocols onamp-list
. This cherry-picks a change from a spec update in #4548 which will be part of the 1.6 release. #4870, #4992
Compare code changes since 1.5.4.
Installation
Now available to install via WordPress.org.
You can also install the amp.zip
build linked below by uploading it in the WordPress admin.
To install as a Git submodule, consider 1.5.5-built.
1.5.4
This is the fourth patch release for the 1.5 branch following the v1.5.3 release.
For the full list of changes in this release, please see the 1.5.4 milestone, with 24 issues and 35 pull requests. Also compare code changes since 1.5.3.
Changelog
Optimizer
- 🚀 Discontinue disabling Optimizer SSR when
WP_DEBUG
is enabled. #4667, #4669 - ✨ Base64-encode the server-side rendered sizer SVG images to prevent corruption by caching/optimization plugins. #4491, #4862
- ⏪ Revert converting decimal image sizes to integers for sizer SVG generation since has landed in the AMP validator upstream. #4863, #4864
- ✨ Tweak Optimizer interfaces for consistency. #4612, #4614
- 📖 Add paragraph about server-side rendering to README. #4841
Embeds
- 🐛 Extend WordPress.tv embed handler to also handle VideoPress so as to avoid validation error when embedding. #4754, #4755
- 🐛 Omit non-standard
type
attribute duringamp-iframe
normalization whentext/html
to prevent Amazon Kindle block from producing validation error. #4758, #4759 - 🐛 Remove the
wp-has-aspect-ratio
class from block embeds to fix extra space on top in Gutenberg 8.2+. #4810, #4813 - 🐛 Use responsive layout for blocks with
alignwide
class so that wide width alignment of iframe-containing blocks is respected. #4692, #4693
Editor
- 🐛 Fix rendering of AMP Preview button tooltip in editor. #4590, #4601
- 🐛 Fix post preview in Reader mode for already-published posts. #4656, #4665
Site Health
- ✨ Suppress Site Health ICU test if site or home URL is not an IDN since not relevant. #4616, #4698
- 🐛 Prevent printing Site Health styles for re-enabling transient caching on every admin page. #4643, #4861
Schema.org Metadata
- ✨ Make
CollectionPage
the default Schema.org JSON+LD metadata@type
for archive queries. #4666, #4680 - 🐛 Prevent output of Schema.org metadata JSON script if empty array. #4783, #4860
Validation
- ✨ Strip leading BOM and whitespace and trailing HTML comment before parsing validation response JSON. #4678, #4679, #4683
CSS
- 🐛 Fix merging of viewport CSS at-rules nested in other rules, fixing an invalid property validation error for the
meta
viewport tag. #4722, #4866
AMP Spec
Infrastructure and Testing
- 🏗 Add GitHub actions to automatically create ZIP build artifacts for pushes to branches and PRs. #4766, #4830, #4832, #4835, #4839, #4836, #4834, #4769
- 🏗 Raise PHPStan level for the
amp/common
package to 4, and overall improve PHPStan static analysis. #4379, #4686, #4865, #4867 - 🏗 Improve testing infrastructure. #4824, #4825, #4654, #4662, #4641, #4642, #4868
Props
Thanks to the many contributors who made this release possible through work on development, design, testing, project management, and more:
Adam Silverstein (adamsilverstein), Alain Schlesser (schlessera), Alberto Medina (amedina), Deepak Lalwani (deepaklalwani97), Kasper Myram (kmyram), ktmn, Laurel Fulford (laurelfulford), Pierre Gordon (pierlon), Renee Johnson (ernee), Ryan Kienstra (kienstra), Sebastian Benz (sebastianbenz), Towhidul Islam Chowdhury (itowhid06), Weston Ruter (westonruter), and Yosu Cadilla (YosuCadilla)
Installation
Now available to install via WordPress.org.
You can also install the amp.zip
build linked below by uploading it in the WordPress admin.
To install as a Git submodule, consider 1.5.4-built.
1.5.4-RC1
This is the first release candidate for v1.5.4. The stable release is due out June 23rd. For the full list of changes in this release, please see the 1.5 milestone, with 24 issues and 35 pull requests. Also compare code changes since 1.5.3. Please report any issues you encounter while testing!
Changelog
Optimizer
- 🚀 Discontinue disabling Optimizer SSR when
WP_DEBUG
is enabled. #4667, #4669 - ✨ Base64-encode the server-side rendered sizer SVG images to prevent corruption by caching/optimization plugins. #4491, #4862
- ⏪ Revert converting decimal image sizes to integers for sizer SVG generation since has landed in the AMP validator upstream. #4863, #4864
- ✨ Tweak Optimizer interfaces for consistency. #4612, #4614
- 📖 Add paragraph about server-side rendering to README. #4841
Embeds
- 🐛 Extend WordPress.tv embed handler to also handle VideoPress so as to avoid validation error when embedding. #4754, #4755
- 🐛 Omit non-standard
type
attribute duringamp-iframe
normalization whentext/html
to prevent Amazon Kindle block from producing validation error. #4758, #4759 - 🐛 Remove the
wp-has-aspect-ratio
class from block embeds to fix extra space on top in Gutenberg 8.2+. #4810, #4813 - 🐛 Use responsive layout for blocks with
alignwide
class so that wide width alignment of iframe-containing blocks is respected. #4692, #4693
Editor
- 🐛 Fix rendering of AMP Preview button tooltip in editor. #4590, #4601
- 🐛 Fix post preview in Reader mode for already-published posts. #4656, #4665
Site Health
- ✨ Suppress Site Health ICU test if site or home URL is not an IDN since not relevant. #4616, #4698
- 🐛 Prevent printing Site Health styles for re-enabling transient caching on every admin page. #4643, #4861
Schema.org Metadata
- ✨ Make
CollectionPage
the default Schema.org JSON+LD metadata@type
for archive queries. #4666, #4680 - 🐛 Prevent output of Schema.org metadata JSON script if empty array. #4783, #4860
Validation
- ✨ Strip leading BOM and whitespace and trailing HTML comment before parsing validation response JSON. #4678, #4679, #4683
CSS
- 🐛 Fix merging of viewport CSS at-rules nested in other rules, fixing an invalid property validation error for the
meta
viewport tag. #4722, #4866
AMP Spec
Infrastructure and Testing
- 🏗 Add GitHub actions to automatically create ZIP build artifacts for pushes to branches and PRs. #4766, #4830, #4832, #4835, #4839, #4836, #4834, #4769
- 🏗 Raise PHPStan level for the
amp/common
package to 4, and overall improve PHPStan static analysis. #4379, #4686, #4865, #4867 - 🏗 Improve testing infrastructure. #4824, #4825, #4654, #4662, #4641, #4642, #4868
Props
Thanks to the many contributors who made this release possible through work on development, design, testing, project management, and more:
Adam Silverstein (adamsilverstein), Alain Schlesser (schlessera), Alberto Medina (amedina), Deepak Lalwani (deepaklalwani97), Kasper Myram (kmyram), ktmn, Laurel Fulford (laurelfulford), Pierre Gordon (pierlon), Renee Johnson (ernee), Ryan Kienstra (kienstra), Sebastian Benz (sebastianbenz), Towhidul Islam Chowdhury (itowhid06), Weston Ruter (westonruter), and Yosu Cadilla (YosuCadilla)
Installation
You can also install the amp.zip
build linked below by uploading it in the WordPress admin.
Up-to-the-minute builds from the 1.5
branch are also available.
1.5.3
This is the third patch release for the 1.5 branch following the v1.5.2 release. The following changes are included in this release:
- ✨ Add “accessibility” sanitizer to ensure
role
andtabindex
attributes are present for elements withon="tap:…"
attributes. #4528, #4535 - ✨ Add button into Site Health test to re-enable CSS transient caching. #4523, #4522
- ✨ Reduce scenarios where DB writes are performed during frontend requests by restricting plugin upgrade routine to admin-authenticated requests. #3284, #4538
- 🐛 Prevent styles from being removed in Customizer preview with Standard mode. #4551, #4553
- 🐛 Restore unification of multi-page post content in Reader mode. #4547
- 🐛 Force status code of validation responses to be
200
so that validation results can be obtained for non-OK responses (e.g. the 404 page). #4532, #4533 - 🐛 Use title case for Paired Browsing link in edit post screen. #4540
- 🐛 Ensure that validation query vars persist through redirects. #4544
- 🐛 Fix various issues with Mustache templates. #4446, #4583
- Skip validating attributes for layout (e.g.
width
,height
, andsizes
) when elements are inside of Mustache templates (in bothtemplate
elements andscript
elements). - Skip validating attributes containing Mustache template variables when the element is inside of a Mustache template.
- Ensure that form sanitizer recognizes Mustache templates located in
script[type=text/plain][template=amp-template]
elements in addition totemplate
elements. - Skip processing
style
attributes that contain Mustache template variables inside ofscript[type=text/plain][template=amp-template]
elements in addition totemplate
elements. - Ensure that URL attributes in Mustache templates do not have Mustache template variables URL-encoded.
- Skip validating attributes for layout (e.g.
- 🏗️ Add Requires plugin header information. #4520, #4543
- 🏗️ Update Optimizer test specs. #4527
- 🏗️ Update tests after
block-library/style.css
changes in Gutenberg 7.9. #4579 - 🏗️ Stub request based on test scenario to fix failing test in Optimizer library. #4588
- ❄️ Mock all embed tests and rename embed class files. #4474
- ❄️ Fix unit tests on WordPress trunk due to introduction of
loading=lazy
. #4563, #4564
See full diff of changes.
Props Alain Schlesser (@schlessera), Alberto Medina (@amedina), Kasper Myram (@kmyram), Pierre Gordon (@pierlon), Ryan Kienstra (@kienstra), and Weston Ruter (@westonruter).
Installation
Now available to install via WordPress.org.
You can also install the amp.zip
build linked below by uploading it in the WordPress admin.
To install as a Git submodule, consider 1.5.3-built.
1.5.2
This is the second patch release for the 1.5 branch. It fixes additional issues that have been reported for the 1.5.0 and 1.5.1 releases. Key changes in the 1.5.2 milestone:
- 🐛 Prevent images with decimal dimensions from causing Optimizer to emit AMP Validation error. #4493, #4506
- 🐛 Prevent
meta
tag sanitizer from erroneously moving HTML5 Microdata meta tags tohead
; only move themeta
tags to thehead
which are required to be located there. #4502, #4505 - 🐛 Raise default threshold for disabling CSS caching. This addresses a performance degradation when parsed CSS transient caching gets disabled due to detecting highly-variable CSS. #4513
- ✨ Add CSS monitoring time series to Site Health debugging info. This will assist with debugging issues related to parsed CSS transient caching getting disabled. #4519
- 🐛 Fix embedding YouTube videos that have hyphens in the IDs; account for an increased variety in URL formats. #4504, #4508
- 🐛 Fix fetch error with external stylesheets by caching response status and headers. #4503, #4509
- 🐛 Fix preservation of Mustache templates contained in
script[type=text/plain]
elements. This was originally fixed in 1.5.0 but the fix was incomplete, as it didn't account for Mustache templates that span multiple lines. #4254, #4276, #4521 - 🐛 Ensure required AMP component scripts are detected when contained inside of an invalid element, by fixing the element child sanitization loop when invalid elements are replaced with children. #4511, #4512
- 🐛 Fix media modal pre-selecting a previously-selected featured image in the post editor. #4414, #4453
See full diff of changes.
Props Alain Schlesser (@schlessera), Alberto Medina (@amedina), Pierre Gordon (@pierlon), Ryan Kienstra (@kienstra), and Weston Ruter (@westonruter).
Installation
Now available to install via WordPress.org.
You can also install the amp.zip
build linked below by uploading it in the WordPress admin.
To install as a Git submodule, consider 1.5.2-built.
1.5.1 [HOTFIX]
In the 1.5.1 milestone:
- 🔥 Eliminate
remove_amp_story_templates
which had bad usage oftax_query
param causing a deletion of more reusable blocks than appropriate in the upgrade routing to remove Stories templates. 👉 If you have lost reusable blocks when upgrading to v1.5.0, you may need to re-create them or restore them from a backup. If upgrading from 1.4.x directly to 1.5.1 then you may see additional Story “Template” posts in your list of reusable blocks; they can be deleted as desired. #4489, #4488 - 🐛 Fix PHP warning for missing
LIBXML_HTML_NODEFDTD
constant. #4485, #4486 - 🐛 Safeguard metadata configuration value against bad filters causing PHP type error. #4484, #4487
See full diff of changes.
Props Alain Schlesser (@schlessera), Andrija Vucinic (@aidvu), Pierre Gordon (@pierlon), Ryan Kienstra (@kienstra), and Weston Ruter (@westonruter).
Installation
Now available to install via WordPress.org.
You can also install the amp.zip
build linked below by uploading it in the WordPress admin.
To install as a Git submodule, consider 1.5.1-built.
1.5.0 [YANKED]
For the full list of changes in this release, please see the 1.5 milestone, with 80 closed issues and 109 merged pull requests.
🔥 This release was yanked. Skip this release in favor of the subsequent v1.5.1 hotfix release, or rather the latest stable release.
Changelog
What follows are the key changes in this release, broken down into categories.
Optimizer
- ✨ Implement server-side rendering (SSR), enabling generation of Optimized (aka Transformed) AMP pages. This includes a PHP port of the AMP Optimizer. #958, #4019, #4369, #4371
- ✨ Remove duplicate AMP component scripts. #3489, #3732
- ✨ Remove AMP component scripts for components that are not present on the page. #3705
Transitional Mode and Paired Browsing
- ✨ Add paired browsing interface for Transitional mode to aid with checking visual and functional parity between AMP and non-AMP versions. This is a useful tool when checking a site for AMP-compatibility, to evaluate whether there are any differences between the two, and if any of them are significant enough to warrant switching to another theme or remaining in Transitional mode; if there are no issues, then Paired Browsing can help determine whether a site is ready for Standard mode. Paired Browsing is accessed via the AMP admin bar menu item on the frontend. #3365, #3656, #4127, #4163, #3863, #3932, #3963
- ✨ Allow opting-out of AMP-to-AMP linking either by adding
rel=noamphtml
to links or by adding URLs to theamp_to_amp_excluded_links
filter. #3689, #4146 - 🐛 Prevent validation errors on valid
mailto:
links; restrict AMP-to-AMP linking to HTTP(S) protocol links. #4182, #4251
CSS Handling
- ✨ Add stylesheet information to the validated URL screen. This eliminates the CSS manifest HTML comment preceding the
style[amp-custom]
element. The stylesheet information is presented in a “Stylesheets” metabox. A table lists out each stylesheet whether coming from alink
element,style
element, orstyle
attribute. The source for the style is indicated (e.g. a specific theme or plugin). The table also indicates the original size of the CSS and the final size after minification (including tree shaking); the percentage of the total CSS taken up by a given stylesheet is also indicated. The table also indicates the priority of a given stylesheet (e.g. where theme styles are more important than plugin styles), and which stylesheets (if any) were excluded due to exceeding the 75KB limit. Lastly, expanding a stylesheet table row allows inspection of the tree shaking effectiveness in a view similar to the coverage tool in Chrome DevTools. #2169, #4026, #4275, #4283, #4294, #4411 - ✨ Show notice on the frontend when there is excessive CSS; this is displayed as a percentage of the total CSS budget (75KB) in a submenu item of the AMP admin bar menu item. #1801
- ✨ Don't tree-shake class names from react-dates when
amp-date-picker
on the page. #4334, #4339 - ✨ Prevent plugin from removing styles for
amp-experiment
variants. #4437, #4438 - ✨ Automatically extract
@viewport
CSS at-rules to meta viewport tag. This eliminates very common validation errors from being reported for themes across WordPress.org. #4118, #4375 - ✨ Detect high cache miss rate for obtaining parsed CSS from variable stylesheets; add ability to prevent storing parsed CSS in transients. This prevents filling up the
wp_options
table when there are stylesheets with random contents. New filters:amp_parsed_css_transient_caching_allowed
,amp_css_transient_monitoring_threshold
, andamp_css_transient_monitoring_sampling_range
. #2092, #4177 - ✨ Honor
Cache-Control
directive for external stylesheet caching. #4293, #4404 - ✨ Improve handling of fetching external stylesheets; provide more information when a
fetch_external_stylesheet
failure happened. #2449, #4257 - 🐛 Exclude processing style attributes inside of Mustache templates. #4374
- ✨ Prioritize inline CSS for theme stylesheets. #3877
- ✨ Preserve styles applied via
[style]
attribute selectors. #4105 - 🐛 Add patch from PHP-CSS-Parser to prevent malformed CSS properties from leaking AMP validation error past the sanitizer. #4113, #4290
- 🐛 Prevent semicolon at end of declaration block in media query from producing invalid CSS; require unreleased version of PHP-CSS-Parser. #4197, #4300
- 🐛 Remove extraneous closing brace from
AMP_Core_Theme_Sanitizer::add_nav_menu_styles()
. Trailing right brace in tree-shaken CSS when using featured image in Twenty Twenty theme. #4335, #4370, #4336
Reader Mode
- ✨ Pass entire Reader mode templates through post-processor. This brings many benefits. Tree shaking now is performed for templates in Reader mode. AMP components used outside the content no longer need manual addition of AMP component scripts (e.g. via the
amp_post_template_data
filter): AMP component scripts are added automatically for components used anywhere on the page. Conversions are also now performed for the entire page, allowing you to pull in non-AMP HTML (e.g. from ACF) anywhere on the template and have it converted automatically to AMP. #2202, #3781, #688, #732, #4184, #4185, #4209 - 🖍 Add core block stylesheets to Reader mode template. Blocks added to the content will now render as expected, whereas before they would appear partially broken due to missing block styles. As long as block styles are enqueued at the
enqueue_block_assets
action, they will be included on the Reader mode templates (and per the previous item, tree-shaken). #4204, #4299 - ✨ Split Reader mode style template part stylesheet from action-supplied styles. This will assist with ensuring that the core styles remain if the styles added via the
amp_post_template_css
action cause the CSS to go over the 75KB limit, even after tree shaking. #4205
Document Parsing
- ✨ Support WordPress installs without UTF-8 charset. Automatically convert to UTF-8, as AMP requires this. #855, #3758, #4296
- ✨ Introduce
AmpProject\Dom\Document
subclass ofDOMDocument
to encapsulate logic for parsing, normalizing, and serializing HTML. #3758, #4104, #4107, #4282, #4297 - 🐛 Prevent removal of closing
table
andtd
tags inscript[template="amp-mustache"]
. Fixes corrupted Mustache templates for tables usingscript[type=text/plain]
. #4254, #4333 - 🐛 Fix parsing of malformed
meta[charset]
tag. #4179, #4181
Sanitization and Validation
- ✨ Improve validating sanitizer with context for why element/attribute is invalid. Previously when there was a validation error...
1.5.0-RC2
This is the second release candidate for v1.5.0, following 1.5.0-RC1 earlier this week. Changes since the previous release candidate include:
- Fix invalid Context column in validated URL screen. #4449
- Ensure validation errors are reported for invalid attributes on the HTML element. #4387, #4440
- Move the Xdebug admin warning to Site Health. #3499, #4432
- Prevent plugin from removing styles for
<amp-experiment>
variants. #4437, #4438
See full list of 11 closed issues and PRs. See also the diff. For the full list of changes in the upcoming stable release, please see the 1.5 milestone.
The 1.5.0 stable release is due out the before WordPress 5.4 is released; since the WordPress release is scheduled for March 31st, the AMP plugin release is scheduled for March 30th.
Props for this second release candidate: Alain Schlesser, Alberto Medina, Bartosz, Pierre Gordon, Ryan Kienstra, and Weston Ruter.
Installation
You can also install the amp.zip
build linked below by uploading it in the WordPress admin.
Please report any issues you encounter while testing!
To install as a Git submodule, consider 1.5.0-RC2-built.
1.5.0-RC1
This is the first release candidate for v1.5. For the full list of changes in this release, please see the 1.5 milestone, with 77 closed issues and 99 merged pull requests. Please report any issues you encounter while testing!
The 1.5.0 stable release is due out the before WordPress 5.4 is released; since the WordPress release is scheduled for March 31st, the AMP plugin release is scheduled for March 30th.
Changelog
What follows are the key changes in this release, broken down into categories.
Optimizer
- Implement server-side rendering (SSR) of AMP pages, enabling generation of Optimized (aka Transformed) AMP pages. This includes a PHP port of the AMP Optimizer. #958, #4019, #4369, #4371
- Remove duplicate script entries. #3489, #3732
- Remove scripts for components that were not detected in output buffer. #3705
- Introduce
AmpProject
namespace. #3810, #4188, #4364
Transitional Mode and Paired Browsing
- Add paired browsing interface for Transitional mode to aid with checking parity. #3365, #3656, #4127, #4163, #3863, #3932, #3963
- Allow opting-out of AMP-to-AMP links. #3689, #4146
- Prevent validation errors on valid
mailto:
links; restrict AMP-to-AMP linking to HTTP(S) protocol links. #4182, #4251
CSS Handling
- Add stylesheet information to validated URL screen, eliminating the CSS manifest HTML comment preceding the
style[amp-custom]
element. #2169, #4026, #4275, #4283, #4294, #4411 - Show notice on frontend when there is excessive CSS. #1801
- Detect high cache miss rate for obtaining parsed CSS from variable stylesheets; add ability to prevent storing parsed CSS in transients. #2092, #4177
- Improve handling of fetching external stylesheets; not enough information given when
fetch_external_stylesheet
failure happened. #2449, #4257 - Prioritize inline CSS for theme stylesheets. #3877
- Preserve styles applied via
[style]
attribute selectors. #4105 - Add patch from PHP-CSS-Parser to prevent malformed CSS properties leaking AMP validation error past the sanitizer. Fixes malformed CSS properties leak AMP validation error past the sanitizer. #4113, #4290
- Automatically extract
@viewport
CSS at-rules to meta viewport tag. #4118, #4375 - Semicolon at end of declaration block in media query produces invalid CSS; require unreleased version of PHP-CSS-Parser. #4197, #4300
- Use
Cache-Control
directive for external stylesheet caching. #4293, #4404 - Don't tree-shake allowed child classes of
amp-date-picker
if it's in the DOM. #4334, #4339 - Remove extraneous closing brace from
AMP_Core_Theme_Sanitizer::add_nav_menu_styles()
. Trailing right brace in tree-shaken CSS when using featured image in Twenty Twenty theme. #4335, #4370, #4336 - Exclude processing style attributes inside of Mustache templates. #4374
Reader Mode
- Pass entire Reader mode templates through post-processor. #2202, #3781
- CSS in Reader mode is not minified. #688
- build_post_featured_image() runs unnecessarily. #732
- Redirect to non-AMP version when making non-singular AMP request. #4184
- Avoid entering The Loop when rendering Reader template. #4185
- Add core block stylesheets to Reader mode template. #4204, #4299
- Split Reader mode style template part stylesheet from action-supplied styles. #4205
- Ensure AMP is not available for disabled posts in Reader mode. #4209
Document Parsing
- Prevent removal of closing
table
andtd
tags inscript[template="amp-mustache"]
. Fixes Mustache templates for tables usingscript[type=text/plain]
are corrupted. #4254, #4333 - Support content after HTML end tag. Fixes failure to normalize documents with HTML comments after
</body>
. #4282, #4297 - Validation broken in Genesis themes by
Document::normalize_document_structure()
. #4104 - Fix parsing of malformed
meta[charset]
tag. #4179, #4181 - Support WordPress installs without UTF-8 charset (by converting to UTF-8). #855, #3758, #4296
Sanitization and Validation
- Improve validating sanitizer with context for why element/attribute is invalid. #1420, #3780, #4405
- Add support for
mandatory_oneof
andmandatory_anyof
attribute constraints. #938, #4285 - Serve back JSON exclusively in
amp_validate
requests. This fixes validation requests to prevent the error: “URL validation failed to due to the absence of the expected JSON-containingAMP_VALIDATION
comment after the body”. #3887, #3898, #4045 - Add
AMP_DOM_Document
& meta tag sanitizer. #3758, #4107 - Validate height, width & layout attributes to prevent percentage units and bogus values being erroneously permitted for width/height attributes. #2146, #3728
- Fix invalid layout on non-AMP elements, where
height=100%
results in invalidlayout=fill
added. #4111 - The HTML4
meta[http-equiv=Content-Type]
causes validation error to leak and should convert automatically to HTML5meta[charset]
. #3469 - Show plugin name when listing incompatible plugins. #3881
- Investigate validation errors that are not sanitized in WordPress.org themes. #4060
- Add validation of individual properties in meta content attributes. #4070, #4137
- Prevent validation errors for URLs with leading or trailing spaces. #4117, #4166
- Add source information for script/style dependencies and inline scripts/styles. Fixes scripts and styles enqueued before wp_enqueue_scripts fail to get sources identified. Identify sources for inline scripts/styles. Ensure core script/style dependencies get enqueueing theme/plugin as source. #4133, #4134, #4...