• I have finally rewritten my .htaccess to ReWrite all of the urls to the ?amp versions created by the AMP plugin as the theme I developed years ago no longer looks and feels as nice as the one I have modified through the AMP plugin templates.
    As such, I no longer wish the WP pages and posts to be canonical nor do I want them to be alternates. Rather I want the ?amp versions to be the canonical and nothing else…

    So, in the single.php I have written
    <link rel="amp_canonical" href="<?php the_permalink(); ?>?amp/" />

    And upon checking the inspect source element, I can see this pulls through the appropriate version HOWEVER, it would appear that the plugin itself also has a directive to pull in the permalink as the canonical… How can I remove/modify/etc this call so it does not reference the unAMPed version at all?

    TIA

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Weston Ruter

    (@westonruter)

    If you want to use AMP as canonical, you should be using AMP theme support: https://github.com/Automattic/amp-wp/wiki/Adding-Theme-Support

    This is where “native mode” is introduced and there are not separate URLs for AMP vs non-AMP.

    Plugin Author Weston Ruter

    (@westonruter)

    Thread Starter austintude

    (@austintude)

    I’m using the 1.0-beta1 and have since killed the htaccess ReWriteRules mentioned previously… however, I have having some serious errors with the Native mode when trying to get AMP validation.

    Eventhough I have tried removing all AMP scripts `<script async custom-element=”amp-sidebar” src=”https://cdn.ampproject.org/v0/amp-sidebar-0.1.js”&gt;
    </script>`
    for example, as well as the
    <script async src="https://cdn.ampproject.org/v0.js"></script>
    and the boilerplate and the noscript version of the boilerplate…
    I am still getting errors reading:

    The tag 'amp-selector extension .js script' appears more than once in the document.

    When I inspect the element of the page I can see both:

    <script async custom-element="amp-selector" src="https://cdn.ampproject.org/v0/amp-selector-0.1.js">
    </script>

    AND
    <script type='text/javascript' src='https://cdn.ampproject.org/v0/amp-selector-latest.js' async custom-element="amp-selector"></script>

    This is consistent with ALL of the amp scripts that are required to get the page to load correctly.
    Thoughts?

    • This reply was modified 6 years, 3 months ago by austintude.
    • This reply was modified 6 years, 3 months ago by austintude.
    • This reply was modified 6 years, 3 months ago by austintude.
    Plugin Author Weston Ruter

    (@westonruter)

    Are you manually printing the amp-selector component script into the page? The plugin does this automatically for you so you should just output the <amp-selector> tag, and the plugin will do the rest.

    Thread Starter austintude

    (@austintude)

    NO. I removed ALL amp associated scripts. I’m totally confuzzled. Also, I can’t get the comments to function. I opened a new testing site to play with the latest beta2 release and have tried commenting both logged in and not on both the Twenty Seventeen theme AND a bog-standard underscores.me theme.
    They are both implementing the ‘native’ version and neither of them function with commenting in blog posts…
    The page I’m playing with is located at https://amptest.austintude.com/
    Any help would be greatly appreciated. I believe once I unlock this mystery, I can hit the ground running.
    TIA

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Force AMP canonical’ is closed to new replies.