Site logo

Archived topic

AMP Validation error after upgrade to 3.0

7 replies · Started by Guilherme on October 16, 2020

Viewing posts 1–8 of 8

Hi.

My site was running with no AMP errors until I upgraded to GP 3.0.2. Now the official AMP plugin started to complain about main.min.js and about this line:

var generatepressMenu = {"toggleOpenedSubMenus":"1","openSubMenuLabel":"Open Sub-Menu","closeSubMenuLabel":"Close Sub-Menu"};

I have GPP 1.12.2 and AMP for GP installed. Everything was perfect before the update.
I restored a backup of version 2.4.2 and now it's working fine again.

I installed GP 3.0.2 on a brand new local test site and the exact same issues were reported.
Please advise.
Thank you.

Thank you for your quick support! It worked.

After posting the issue, I found a workaround, writing a function to manually dequeue the script. I didn't want to mess with your plugin, so I used Code Snippets.

add_action( 'wp_footer', 'gbd_dequeue_main_js',15);

function gbd_dequeue_main_js() {
	wp_dequeue_script('generate-main');
}

Now that your plugin has that code, I can deactivate this.

Thank you once more.

No problem! Glad it worked :)

Hi Tom

After upgrading to GeneratePress 3.10 and GP Premium 2.10 I get AMP faults. I have tried to change amp-for-generatepress.php in the plugin editor with the code suggested 8. October but with no luck. The url for the site is https://www.jozan.net/rug-books/

I get this messages

Invalid value for width</ property: auto
Details | Copy to clipboard
HTML attribute

--
Markup Status
Removed

Information
AMP allows a specific set of elements and attributes on valid AMP pages. Learn about the AMP HTML specification. If an element or attribute is not allowed in AMP, it must be removed for the page to be cached and eligible for prerendering.

If all invalid markup is “removed” the page will be served as AMP. However, the impact that the removal has on the page must be assessed to determine if the result is acceptable. If any invalid markup is “kept” then the page will not be served as AMP.

Error code
MISSING_REQUIRED_PROPERTY_VALUE
Element attributes
name viewport
content width=auto
Invalid property
width: auto (required value: device-width)
Node name
content
Parent element
meta
Sources

and this
Invalid inline script
Details | Copy to clipboard
JS

GeneratePress
Markup Status
Removed

Information
AMP does not allow the use of JS <script> tags unless they are for loading AMP components, which are added automatically by the AMP plugin. For any page to be served as AMP, all invalid script tags must be removed from the page. Instead of custom or third-party JS, please consider using AMP components and functionality such as amp-bind and actions and events (as opposed to JS event handler attributes like onclick). Some custom JS can be added if encapsulated in the amp-script. Learn more about how AMP works.

If all invalid markup is “removed” the page will be served as AMP. However, the impact that the removal has on the page must be assessed to determine if the result is acceptable. If any invalid markup is “kept” then the page will not be served as AMP.

Error code
DISALLOWED_TAG
Invalid markup
<script … >
Element attributes
id generate-a11y
Element name
script
Parent element
body
Text content
Sources

Regards
Ivan

Hi Tom

This solved the problem - thanks

Regards
Ivan

Well - I thought it did - but it did not

I will post a new topic as suggested

Regards
Ivan

This archived topic is closed to new replies.