Web-stories-wp: Leverage AMP Optimizer if possible

Created on 20 Apr 2020  路  5Comments  路  Source: google/web-stories-wp

Feature Description

Follow-up to #967.

We should leverage the new SSR capabilities when the AMP plugin is active. Once the Optimizer is available as its own PHP package, we can also include it via Composer; we just need to avoid conflicts.

Prior art: https://github.com/ampproject/amp-wp/blob/85e45e895629bddf674e8ca2181128a1bcc6ad8c/includes/class-amp-theme-support.php#L2054-L2084

For this to work, the current output needs to be wrapped in an AmpProject\Dom\Document instance.


_Do not alter or remove anything below. The following sections will be managed by moderators only._

Acceptance Criteria

QA Instructions

AMP Output Integration WordPress PHP WP & Infra Enhancement

Most helpful comment

For this to work, the current output needs to be wrapped in an AmpProject\Dom\Document instance.

If you don't already us a DOM object for your own processing, you can use TransformationEngine::optimizeHtml( string $html ) instead of TransformationEngine::optimizeDom( Document $document ).

All 5 comments

For this to work, the current output needs to be wrapped in an AmpProject\Dom\Document instance.

If you don't already us a DOM object for your own processing, you can use TransformationEngine::optimizeHtml( string $html ) instead of TransformationEngine::optimizeDom( Document $document ).

Currently blocked by https://github.com/ampproject/amp-toolbox/issues/567 it seems

Right now we get:

AMP optimization could not be completed due to the following:
 - CannotRemoveBoilerplate: Cannot remove boilerplate because of an unsupported layout: amp-story

The server side rendering is blocked, but the other transformers will do their optimizations.

Started running into this/similar issue, further explained here: https://wordpress.org/support/topic/only-super-admin-can-preview-or-publish-web-stories/

@brianpetro Thanks, I just replied, but note that it's not related to this ticket here at all.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jauyong picture jauyong  路  4Comments

obetomuniz picture obetomuniz  路  3Comments

swissspidy picture swissspidy  路  3Comments

dvoytenko picture dvoytenko  路  3Comments

Maverick283 picture Maverick283  路  3Comments