Skip to content

Ignore admin bar for AMP validation purposes #1921

@westonruter

Description

@westonruter

The inclusion of the admin bar was included in AMP via #1205. However, the amount of admin bar CSS is so large (20KB) that it takes up about 40% of the total allowed CSS in AMP (50KB). For this reason it very frequently causes excessive_css validation errors when an authenticated user is browsing the frontend. As opposed to providing this option or trying to automatically disable the admin bar when there is too much CSS (#1800), we could instead just exclude admin bar CSS (including any styles that depend on admin-bar) from being considered in the 50KB budget. This can mean that an authenticated user will often be served an invalid AMP page, but this is of little importance since the unauthenticated visitor (including crawlers) will only get the valid AMP pages for indexing. The admin bar has an indicator of AMP validity already, so users who have the AMP validator browser extension would just need to trust the admin bar status rather than the browser toolbar, or else open the URL in an incognito window to double-check. AMP now supports an explicit “dev mode” (ampproject/amphtml#20974) for when invalid markup is intentionally being included in the page. The AMP validator browser extension will explicitly be aware of this mode (ampproject/amphtml#24176) so there will not be concerns about it alerting the user of errors. Initial support for dev mode in the AMP plugin landed with #3084.

👉 For full list of changes, please refer to description in PR: #3187.

Done/Obsolete

Metadata

Metadata

Assignees

No one assigned

    Labels

    CSSEnhancementNew feature or improvement of an existing oneP0High priority

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions