-
Notifications
You must be signed in to change notification settings - Fork 385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable generation of Optimized (aka Transformed) AMP pages #958
Comments
In AMP the SSR is also termed “transformed”. The validator has just landed with some recognition of this which we're not explicitly skipping from the generated spec: 51d81ab. We'll potentially need to revert that and add some awareness of a |
See also https://twitter.com/westonruter/status/1120061001443893248 We need to make sure the Transformed AMP sanitizer, along with the other sanitizers, are turned into a separate package which can be used standalone. |
Depends on |
An important blocker for SSR (transformed intrinsic layout support) has been lifted: ampproject/amphtml#24119. For pending reference implementation of SSR intrinsic layout, see ampproject/amp-toolbox#443. |
Any QA instructions to be added here, @schlessera ? |
Testing instructions:
/cc @csossi |
Also verify that the result is Valid AMP (aside for dev mode when logged in). |
Good point, updated the instructions. |
We can speed up the serving of AMP pages by pre-rendering them and serving them in the same way they are served from an AMP cache. In short, the processes performed by the AMP Optimizer should be ported into the plugin. Something important to note here that when pre-rendering is performed, there will somewhat counter-intuitively need to be a paired mode even when a site is AMP Canonical. The reason is:
So the pre-rendered AMP version of a page would would be canonical URL, and there would be an
amphtml
link to the same exact content without the pre-rendering logic applied. This is similar to the existing paired mode works, except here the canonical version is generated from the AMP version via pre-rendering. So it's important to note that this pre-rendering should not be offered on sites that are not using Canonical AMP, as it would not make sense to have a pre-rendered AMP version alongside the valid AMP and the non-AMP content.As for where the pre-rendering should be performed, it should be done right after the call to
AMP_Content_Sanitizer::sanitize_document()
inAMP_Theme_Support::prepare_response()
:https://github.com/Automattic/amp-wp/blob/1ab37c654d8c36cb1e17f1c997a6a2f00002273c/includes/class-amp-theme-support.php#L813-L815
For example:
Since
is_amp_endpoint()
currently always returnstrue
ifamp_is_canonical()
then this will need to be amended to support the case for pre-rendering. In other words, even on a canonical-site there will be the need for separate AMP endpoint URLs. So theif ( amp_is_canonical() ) { return true; }
conditional may need to be removed here. Related to #934.👉 For more on server-side rendering, see Faster AMP on the origin: AMP + SSR = ⚡.
👉 For implementation notes, refer to AMP SSR Toolkit Implementation Guide.
The text was updated successfully, but these errors were encountered: