[Resolved] AMP Validation error after upgrade to 3.0

Home Forums Support [Resolved] AMP Validation error after upgrade to 3.0

Home Forums Support AMP Validation error after upgrade to 3.0

  • This topic has 7 replies, 3 voices, and was last updated 8 months ago by Ivan.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1492779
    Guilherme

    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.

    #1493514
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    You’ll need to make this change to the AMP for GP plugin: https://github.com/tomusborne/amp-for-generatepress/commit/97d38e52a44bc15c008853526d6987260eee83c3

    We’re planning on getting the plugin added to the repo ASAP.

    #1493597
    Guilherme

    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.

    #1494657
    Tom
    Lead Developer
    Lead Developer

    No problem! Glad it worked 🙂

    #1978874
    Ivan

    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

    #1979221
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Any chance you can open a new topic with your URL so we can check?

    Also, make sure you’re using the latest version of our AMP for GP plugin: https://docs.generatepress.com/article/amp-compatibility/

    #1979290
    Ivan

    Hi Tom

    This solved the problem – thanks

    Regards
    Ivan

    #1979292
    Ivan

    Well – I thought it did – but it did not

    I will post a new topic as suggested

    Regards
    Ivan

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.