-
Notifications
You must be signed in to change notification settings - Fork 383
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
Send entire templates in Reader/Classic mode through the sanitizers #2202
Comments
Question about working on this Hi @westonruter, You're the assignee here, so I wanted to ask if it's alright if I work on this. Thanks, Weston! |
Yes, go ahead. |
Thanks! |
The solution here should also cause Polylang to end up working. Ref: https://wordpress.org/support/topic/static-home-page-with-polylang-2/page/2/#post-12066633 |
This is on hold until we've processed #3662 and the linked document https://docs.google.com/document/d/1ROTa0QlCbW-wDxeZOkn8REEHaOLs22qSrBPKshcYcrE/edit?usp=sharing. |
@schlessera I took a stab at this, looking to see what is the minimal amount of changes which could be done while also getting all of the benefits: #3781. |
Steps To Test
(Functional testing won't really cover much of this work, as it involves sending the entire templates through the sanitizer. Testing that would require |
Verified in QA |
Currently only content (and the featured image) are sent through the sanitizers. This is the classic approach, and it is why there's the content in
amp_content_sanitizers
. However, limiting the sanitizers to the content has some problems which would be fixed by sanitizing the entire page:amp_post_template_head
oramp_post_template_footer
) is not sent through the sanitizers, resulting in the possibility of invalid AMP pages when plugins don't implement AMP properly. This has come up frequently in the support forums. By sanitizing the entire document, this would no longer happen frequently.style.php
template and theamp_post_template_css
action. The style rules are not sent through the CSS sanitizer. This means that they are neither minified nor tree-shaken. If the entire template were sent through the sanitizers, then this would be a key benefit (and would resolve CSS in Reader mode is not minified #688).$this->load_parts()
is not used).AMP_Theme_Support
for both.This should make Reader mode templates available for Polylang to translate (topic).
By making Reader mode templates regular WordPress templates, we'll also be able to avoid situations where users copy Reader mode templates to be used in Transitional mode, only to find that they start getting fatal errors due to
$this
. (Examples: 1, 2, 3).Update: This is probably a bit out of scope here. I think we should take the existing Reader mode post templates and port them to regular WordPress theme templates, but when we do so we need to introduce generic
amp_head
andamp_footer
actions (and the like) which run instead ofamp_post_template_head
(à lawp_head
) andamp_post_template_footer
(à lawp_footer
), similar to what we did for stories withamp_story_head
. Theamp_post_template_*
actions should be deprecated because they are passed aAMP_Post_Template
instance which is not relevant when templates can render any WordPress query, including index pages.The text was updated successfully, but these errors were encountered: