Site logo

[Resolved] Amp Menu Troubleshooting

Home Forums Support [Resolved] Amp Menu Troubleshooting

Home Forums Support Amp Menu Troubleshooting

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1861692
    William

    I realize the limitations of amp pages, but want to make sure what I have is as good as it gets. Two issues on two related sites:

    For site 1, it has a nested menu. The non-amp version of the page shows as expected on both the desktop and smartphone. The amp version does not show the nested hamburger menu items.

    For site 2, no nested menu. The non-amp version of the page shows as expected on both the desktop and smartphone. The amp version shows the hamburger menu, but the background is transparent, making it nearly impossible for the visitor to see the options.

    I do have the AMP for GeneratePress plugin installed.

    Bill

    #1862041
    Elvin
    Staff
    Customer Support

    Hi William,

    Does the amp plugin you use have exemption feature? Normally, you should exempt GP Premium plugin from it so the script needed by the menu will run. AMP disables scripts so this exemption is necessary.

    For #2: It’s a CSS issue. You can set the background of the menu on Appearance > Colors > Primary Navigation so it’s not transparent.
    If this doesn’t work, make sure to check if there are custom CSS that forces the navigation to go transparent.

    #1862509
    William

    The amp plugin I use is from the amp project https://wordpress.org/plugins/amp/

    If I suppress the invalid markup, which is being generated by GP Premium, the plugin will not generate an AMP page. Here is more detail on the problem.

    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 name
    script
    Parent element
    head
    Text content
    Sources
    #1 Type: Plugin
    Name: GP Premium (gp-premium)
    Function: GeneratePress_Hook::execute_hook()
    Action: wp_head (priority 10)
    Location: elements/class-hooks.php:205

    I will take a look at #2 shortly. I will tell you the primary navigation is not transparent for non amp page. The sites in question are here:

    https://webhostconnect.com
    https://crunchopedia.com

    #1863794
    Tom
    Lead Developer
    Lead Developer

    The first issue is strange – that sub-menu should work fine. I am seeing a handful of errors in your Console (right-click + Inspect): https://www.screencast.com/t/MIu0Z6sR

    That could be causing the issue. Does it persist if you deactivate your other plugins (not the AMP or GP ones)?

    As for the <script> issue you mentioned above – this looks like it’s been added as a Hook Element in “Appearance > Elements”.

    Do you have any scripts added in there?

    #1864940
    William

    Tom – Thank you, almost there with this one.

    The Console errors are now fixed (I needed to add blog: to my Content-Security-Policy), this fixed the submenu not showing. I also removed the offending script, which was a google analytics script added as a Hook Element (you are good at spotting this stuff).

    Bill

    #1866359
    William

    Thank you

    #1867187
    Tom
    Lead Developer
    Lead Developer

    No problem!

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