• Resolved georgebest

    (@georgebest)


    Hi,

    I have an issue that I am unable to solve. Hope you guys can help or provide more information about it.

    I need to exclude some specific urls from amp to amp link (auto mobile redirect). As I can see, there are some filters to do that, but at the end, the param ?noamp=mobile will be added to the end of url. Now the issue is that that url will not be cached.

    So my question is that, is there a way to disable mobile direction for specific urls without ?noamp=mobile

    Thanks in advance!

    Best regards,

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi @georgebest,

    Thanks for contacting us, you can disable AMP by post and page, or by post type, you can have a look in this vídeo:

    Thread Starter georgebest

    (@georgebest)

    Thanks for your prompt reply.

    But that option does not help in my case. I need to disable AMP for custom post type with children item. For example: site.com/manga/chapter. But need site.com/manga turned AMP on.

    Do you have any filter that can solve my case?

    Best regards,

    Plugin Support Milind More

    (@milindmore22)

    Hello @georgebest

    Yes you can exclude selected URLs from AMP TO AMP linking using the filter
    amp_to_amp_excluded_urls

    We will recommend disabling mobile redirection from AMP plugin settings to prevent users from being redirected to the AMP version.

    You can also disable all AMP to AMP linking using amp_to_amp_linking_enabled filter.

    Hopefully this is helpful!

    Thread Starter georgebest

    (@georgebest)

    Hi @milindmore22

    Thanks for your information.

    As I checked, amp_to_amp_excluded_urls filter will add ?noamp=mobile at the end of url. That is not what I want since it will not be cached anymore.

    Regarding this filter, amp_to_amp_linking_enabled, it will disable AMP to AMP for entire site, right? But I still need the AMP for some pages.

    Do you have any other ideas?

    Best regards,

    Plugin Support Milind More

    (@milindmore22)

    @georgebest

    As I mentioned before if you disable Mobile redirect from AMP settings, it will not include ?noamp=mobile in excluded URL’s (Screenshot)

    We enforce the ?noamp=mobile param in case, the user has enabled mobile redirect and checked the AMP page on mobile, in that case, he will be redirected to the AMP page on Mobile.

    Example Code:

    add_filter( 'amp_to_amp_excluded_urls', function( $excluded_urls ) {
    	
    	$excluded_urls[]= 'https://amp-support.rt.gw/hello-world/';
    	return $excluded_urls;
    } );

    Example Test with both normal AMP URL and Excluded URL
    https://amp-support.rt.gw/amp-to-amp-linking/?amp=1

    Thread Starter georgebest

    (@georgebest)

    Thanks @milindmore22,

    But if I turn off Mobile redirect option, how the visitor can open amp version? Does he need to add /amp param manually to the url and reload? I prefer automatically loading AMP version when visitor open page on mobile devices, so I turned on Mobile Redirect option.

    If we use amp_to_amp_excluded_urls filter, will this add the ?noamp=mobile at the end of excluded url? I found out that information here.

    https://github.com/ampproject/amp-wp/issues/4913

    I am appriciated for your patient to explain this for me. Thanks so much.

    Best regards,

    Plugin Support Milind More

    (@milindmore22)

    Hello @georgebest

    The visitors will land on AMP pages when they search for something on Google, They will be presented with an AMP cache page. in case you have another traffic source such as social media links etc. you need to post links with /amp/ endpoint for users to visit the AMP page, or without /amp/ in case you don’t.

    If they click the link to a non-AMP page (excluded URL) on the AMP cache they will land on your site on a non-AMP page.

    If you exclude URLs’ using amp_to_amp_excluded_urls OR amp_to_amp_linking_element_excluded and Mobile redirect is Enabled, it will add ?noamp=mobile

    If you exclude URLs’ using amp_to_amp_excluded_urls OR amp_to_amp_linking_element_excluded and Mobile redirect is Disabled, it will use non-AMP URL without parameter.

    Thread Starter georgebest

    (@georgebest)

    Thanks for your explanation. I got it now.

    Have a nice week!

    Best regards,

    As we didn’t receive a response I’ll mark this as resolved. Feel free to open a new support topic if you require any further assistance.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Cache the page with param ?noamp=mobile’ is closed to new replies.