J!Extensions Store™
Faq The AMP validation fails because of invalid attributes, what to do?

The AMP validation fails because of invalid attributes, what to do?

Created on:Saturday, 06 June 2015 00:00

In some cases you could experiment the AMP validation failing because of the usage of invalid attributes that are not compliant with the Google AMP format. First of all it's recommended that you turn on the debug mode of JAmp and use the Google AMP test toolbar to validate and identify all invalid HTML tags or attributes.

Some components may use arbitrary HTML attributes not following HTML5 standards. Although this is not a big problem for the non-strict plain HTML, this issue will invalidate the Google AMP format which instead is based on strict rules.

For example Virtuemart uses non-standard attributes that are not valid and can't be accepted by the Google AMP format. In the image below you see several invalid and empty attributes in a <span> tag:




For this reason JAmp has special parameters that allows to exclude invalid tags or attributes.

To fix the issue in the example of Virtuemart, you have to specify all the invalid attributes used by Virtuemart using the parameter 'List of disallowed attributes' and specifying the list of invalid attributes comma separated as: 'no,numeric,noise,key,1008'.

As an alternative solution it's even possible to completely remove the element having invalid attributes by CSS selector, using the parameter 'Elements to remove by CSS selectors' with the value: 'div.PricebasePrice'



If it appears that these settings don't have any effect, most probably it means that there is a system plugin adding contents dynamically, thus bypassing the exclusion filters of JAmp. If this is the case, try to identify and exclude that plugin under JAmp settings for plugins exclusions, eventually pay attention to the ordering of system plugins to have JAmp listed before the plugin to exclude:




Additional forum references:
Page not valid, Virtuemart product page with price
AMP warning from google JAmp - multiple warnings in Google