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._
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.
Most helpful comment
If you don't already us a DOM object for your own processing, you can use
TransformationEngine::optimizeHtml( string $html )instead ofTransformationEngine::optimizeDom( Document $document ).