• Resolved keshabee

    (@keshabee)


    It would be nice if post content had a button possibly at center or right where top layer where it could state “view content post with use of AMP”
    as i am using the reader mode and noticed one has to always write “/amp” after the post url to view amp look post.
    But what about if the user was non techy to understand how to add the amp usage or possibly using mobile phones where one becomes lazy to add url manually.

    Hope to hear from you soon

Viewing 2 replies - 1 through 2 (of 2 total)
  • @keshabee Thanks for the suggestion. The plugin is intended achieve AMP valid status using existing WordPress themes where possible, without adding any additional markup. You could always apply a link using a function similar to the below:

    function add_amphref_link($content){
             if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
     			return $content;
    		 }else{
    		 	global $wp;
             	$content .= '<a href="'.amp_get_permalink( get_queried_object_id()).'">View AMP version</a>' ;
    			return $content;
    }}
    add_filter( "the_content", "add_amphref_link" );

    Most visitors to your site probably arrive on an AMP URL when discovered via search from mobile, as opposed to manually adding the /ampor /?amp suffix. Search engines have various factors that determine what version of a site is served if using the plugin in reader or transitional mode.

    Thread Starter keshabee

    (@keshabee)

    @jamesosborne Thank you for your quick response and detailed note.
    The code was so helpful, but I wanted to ask if there was a method to make the “View AMP version” show only on the post.
    On the Supported Templates: I selected The following content types post and media to be available as AMP:

    As I noticed, the link “View AMP version” kept on showing up in areas of pages and buddy-press profile.
    Which was odd because I was hoping it would only be displayed in the post
    Hope to hear from you soon.
    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘View post as AMP’ is closed to new replies.