• Resolved bredless

    (@bredless)


    Hello!
    I have a problem with my site.
    I already had experience of successfully setting up AMP pages with your plugin. And faced the same problem on multiple sites. And I decided to go through the whole setup cycle from scratch.

    I just created AMP version.
    My Settings:
    Reader Mode
    Redirect mobile visitors to AMP
    Paired URL Structure – Path suffix: /amp/

    I use Jannah theme for WordPress and I am setting the appearance of the AMP page through it.

    The problem is here:
    in the top right burger menu you can see that all links are “/amp/?amp=1”, but i choose ‘path suffix’, not ‘query parameter’.
    I found a custom solution that removes these endings on links (you can see it on Nachrichten in burger menu).
    To achieve these i used a href=”/nachrichten/”>Nachrichten in link texts in wordpress menu structure settings (wp-admin/nav-menus.php).

    This solution results in two links appearing in the page code. One of them is with the same ending “/amp/?amp=1”, and the other with the desired one is “/amp/”. It doesn’t look good, so i think there must be some alternative.

    I also created custom footer menu for tests, where I only use links like <a href=”/nachrichten/”>Nachrichten – you can see it in the page.
    Also in the code you can see that each page has two links.

    https://joxi.ru/eAOylqdh6QPZam

    The main question is how to get rid of the ending “?amp=1” if I chose “Path suffix: /amp/”?
    Could this be a plugin bug or is it some kind of bug on my side?

    • This topic was modified 3 years, 4 months ago by bredless.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Milind More

    (@milindmore22)

    Hello @bredless

    Thank you for the support topic, Did you seen the same issue if you temporarily switched to another theme? The Jannah theme forces its settings on the AMP plugin they also have their own Reader Mode theme.

    You can find the code in jannah/famework/plugins/class-tielabs-amp.php

    It will be best to contact the Janna theme author to check if they are modifying the URL structure.

    Thread Starter bredless

    (@bredless)

    I’ve tested a dozen visual themes. And you seem to be right – the problem is with Jannah.
    In any case, thanks for the help, I will contact the theme developers.

    If you can, give me some advice:
    Is there any way to make amp pages in google cache have links in the menu directly to the google server and not to my site?
    In the current version it turns out like this – Google caches one page. But all links on it lead directly to my site and not to the same page cached in Google. Is there any possible way to implement linking directly in google cache?`

    For Example:
    I have a site examplesite.com
    I used AMP plugin and make Paired URL Structure – Path suffix: /amp/
    Main page is cached in Google here:
    https://www.google.com/amp/s/examplesite.com/amp/
    In this main page i have link to another page – examplesite.com/page2
    If a visitor clicks on this link on the page “https://www.google.com/amp/s/examplesite.com/amp/&#8221;, it will be redirected to my site page –
    https://examplesite.com/page2/amp, and not google cache page, looks like https://www.google.com/amp/s/examplesite.com/page2/amp/

    Is there any way to do it? What you think?

    Plugin Support Milind More

    (@milindmore22)

    Hello @bredless

    I am not aware how Jannah Theme has added the query parameter, but I am guessing they have added it using nav_menu_link_attributes filter

    Can you please add the below code snippet in your themes functions.php or in a custom plugin and see if that resolves your issue

    add_filter(
    	'nav_menu_link_attributes',
    	function ( $atts ) {
    		if ( false !== strpos( $atts['href'], '?amp=1' ) ) {
    			$atts['href'] = remove_query_arg( $atts['href'] );
    		}
    		return $atts;
    	},
    	20
    );

    Regarding AMP cache URL, yes that is appropriate behavior the AMP cache only displays a single article, and clicking any link from the AMP cache should take the user to your site, otherwise the user won’t be able to leave the AMP cache.

    Thread Starter bredless

    (@bredless)

    Hello @milindmore22. Thanks for help. I’ll try and come back with an answer later.

    Regarding AMP cache:

    Is it possible to make the user get into the amp cache and eventually stay in it? That is, the user did not go to our site and the page /amp/ from the Google AMP cache, but went between these pages in it.
    Isn’t that logical and would not be more correct than transferring the user to the original site?

    Maybe for this it is worth affixing links like “https://www.google.com/amp/s/examplesite.com/page2/amp/&#8221; to all elements?
    Or is there some alternative approach that might work?

    it would be great to find an option that automatically replaced all links to the amp version of the site with the google amp cache.

    The main idea was to put relative links to all elements in the menu and, after saving, get the ampcachepage-to ampcachepage linking inside the Google cache.

    • This reply was modified 3 years, 4 months ago by bredless.
    • This reply was modified 3 years, 4 months ago by bredless.
    Plugin Support Milind More

    (@milindmore22)

    Hello @bredless

    I don’t know if that’s possible, The AMP cache URL’s are generated by the AMP cache server something we can’t control using the AMP plugin, I will recommend checking with AMP support for it.

    @bredless As we haven’t received a response, I’ll mark this as resolved. Feel free to open a new support topic if you continue to encounter issues, or reopen this topic and we’d be happy to assist. Thank you!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Menu links issue, /amp/?amp=1’ is closed to new replies.