- This topic has 6 replies, 3 voices, and was last updated 4 years, 10 months ago by
Tom.
-
AuthorPosts
-
July 19, 2021 at 2:41 pm #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
July 19, 2021 at 9:58 pm #1862041Elvin
StaffCustomer SupportHi 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.July 20, 2021 at 4:28 am #1862509William
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:205I 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:
July 20, 2021 at 7:44 pm #1863794Tom
Lead DeveloperLead DeveloperThe 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?
July 21, 2021 at 8:52 am #1864940William
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
July 22, 2021 at 7:16 am #1866359William
Thank you
July 22, 2021 at 8:06 pm #1867187Tom
Lead DeveloperLead DeveloperNo problem!
-
AuthorPosts
- You must be logged in to reply to this topic.