• My actual amp URL is:
    https://post-url/?amp=1

    But the link declared in the header of my non-AMP pages is
    <link rel=”amphtml” href=”https://post-url/amp/” />

    Maybe this is the reason why my APM pages are still not index. Any advise on how to fix this?

    • This topic was modified 8 years, 1 month ago by riccian. Reason: added additional info
Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter riccian

    (@riccian)

    The title should be “Actual AMP URL is different from the <link rel=”amphtml”> URL”

    What is your permalink structure set to? (i.e. the value at Settings > Permalinks)

    Thread Starter riccian

    (@riccian)

    It is custom.

    domain.com/%category%/%postname%/

    If you want to force the AMP URL to the querystring version, in 0.4 you can do:

    
    add_filter( 'amp_pre_get_permalink', 'riccian_force_querystring_permalink', 10, 2 );
    
    function riccian_force_querystring_permalink( $url, $post_id ) {
        $permalink = get_permalink( $post_id );
        $url = add_query_arg( AMP_QUERY_VAR, 1, $permalink );
        return $url;
    }
    

    Hey @batmoo how can I remove the slash at the end of the amphtml url? Should I use “amp_pre_get_permalink” filter? And where to implement the code?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Actual AMP URL is different from URL’ is closed to new replies.