-
Notifications
You must be signed in to change notification settings - Fork 382
Description
Feature description
Alongside plugin compatibility scanning (#4719), scanning is also needed for the active theme. In particular, if the theme is not generating validation errors, then Standard or Transitional modes may be good choices. If the theme is generating validation errors, however, then Reader mode may be the best bet especially if the user does not have technical ability to fix the issues or evaluate whether the invalid markup can be removed.
There's one big caveat here for recommending Reader mode, and specifically a Reader theme. In particular, it may not be advisable if the active theme is violating a best practice of registering post types, taxonomies, post types, blocks, and widgets in plugins rather than in theme. If the active theme is registering a post type, for example, and a Reader theme is selected, then this post type will be absent entirely.
What we need to do is get a list of all registered blocks, widgets, post types, and taxonomies when the active theme is running. Then we need need to do it again with the active theme switched to an empty one. If there is a difference, then the missing entities were registered in the theme and will not be available in the new Reader mode. In such a mode, only Classic theme would be recommended. And we will need to list out what will not be available if a Reader theme is selected.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
The user is guided to choose the best template mode based on their active theme/plugins.
Implementation brief
- Add a new Onboarding Wizard step for Site Scanning as well as an area on the Settings Screen to initiate a scan.
- Obtain validation results for URLs representative of the site, using key WP templates (homepage, single post, search results, category archive, etc. as returned by
\AmpProject\AmpWP\Validation\ScannableURLProvider::get_urls()). Important: The list of URLs to validate should be returned and then each URL should be scanned. This must be done instead of scanning all URLs with loopback requests in one request to avoid timeouts. - Gather list of theme-registered entities (post types, shortcodes, blocks, taxonomies, etc.) which are (erroneously) registered in the theme. See Add REST endpoint providing post types, taxonomies, blocks, and widgets registered by the theme #5751.
- Based on the above results, in the Onboarding Wizard and Settings Screen:
- If there are no validation errors reported at all (neither from the theme nor plugins), recommend Standard mode.
- If there are validation errors coming exclusively from plugins, recommend Transitional mode.
- If there are validation errors coming from the theme, recommend Reader mode.
- If there are theme-registered entities (step 2 above), inform them in the Reader theme selection that AMP Legacy is the only theme available. Otherwise, any Reader theme can be chosen.
- Make sure template mode warnings are displayed on mobile. See Wizard Step: Theme compatibility scanning #4795 (comment).
QA testing instructions
Demo
Changelog entry
Metadata
Metadata
Assignees
Labels
Type
Projects
Status