ahmedkaludi / accelerated-mobile-pages

Automatically add Accelerated Mobile Pages (AMP Project) functionality on your WordPress.
http://ampforwp.com
Other
176 stars 96 forks source link

rel="next" & rel="prev" pagination meta tags #2343

Closed shtefcs closed 6 years ago

shtefcs commented 6 years ago

Since the AMP is lot about SEO you are missing one very important stuff and that is rel="next" and rel="prev" paginations meta tags.

According to Google and other SEO experts, pagination pages should not be <noindex> , nofollow etc.

Check the screenshot:

Source: https://www.contentkingapp.com/academy/pagination/ Read more on Google Blog: https://webmasters.googleblog.com/2011/09/pagination-with-relnext-and-relprev.html

You should definitely consider adding this in next update @ahmedkaludi since its very important aspect of SEO, know asn duplicate content and cannibalization

It should be included in all paginations pages, posts, searches, homepage, etc.

Edit: This is how what paginated pages should have:

MohammedKaludi commented 6 years ago

@ahmedkaludi Please take a look at this ticket and add the ticket in this milestone(w15), so it can be fixed and pushed in next update cycle.

Frenchomatic commented 6 years ago

Yes this has been missing for quite some time. It would need to work properly in AMP takeover too. Basically when in a hybrid system of a canonical version and an AMP version, a /amp/ will be needed on prev and next links. However, when in AMP takeover then it will need to be exactly as shown above in shtefcs's screenshot as /amp/ is never being used.

seoexpert-im commented 6 years ago

This is exactly what i`m looking for...i hope that problem with pagination will be fixed in next update...cheers

shtefcs commented 6 years ago

Hey @MohammedKaludi what is up with this issue? Shouldn't you push this to W15 Milestone which was 2 days ago ?

I would just like to know when you are planning to push this, since we delayed project launch just cause of this feature.

We either gonna remove pagination button manually so we don't have duplicate content/pages on our site our wait for this push. But its depend on when you planned to do it, cause SEO is very important aspect of our project, and that is why we are using AMP plugin.

Peace,

jelenajjo commented 6 years ago

Is there anyway you can give us information on this issue? Whether you planning for next release or not. I can see from previous comments you stated will be released in previous update, but now as I can see it's not even labelled as Next Update issue.

I would appreciate your response @MohammedKaludi @ahmedkaludi

ahmedkaludi commented 6 years ago

@jelenajjo I'm moving this ticket to the priority, I will make sure that this feature is built faster and it gets added in the next release cycle.

Frenchomatic commented 6 years ago

That is a good move as it effects SEO

jelenajjo commented 6 years ago

Thank you @ahmedkaludi , you made my day.

I was researching bit how to do it, but PHP is not my language unfortunate. This is the first time I am using WP, and it's just cause of your AMP plugin.

Maybe this can help you:

https://qcybb.com/rel-next-prev-meta-tags/ https://wordpress.stackexchange.com/questions/36800/adding-rel-next-rel-prev-for-paginated-archives

Jelena

Frenchomatic commented 6 years ago

Just tested this in functions.php of my normal theme. It works for me on AMP takeover scenarios and on hybrid systems the AMP version gets the next and previous links. You may like to try it until it goes into the plugin. It appears to work on both blog posts pages and category pages. However, be aware that a static home page will get a next link unless a test is put around the inner code. Hence the test for front_page()

function amp_head_special() {

      global $paged;

       if (  !ampforwp_is_front_page() )
       {
             if ( get_previous_posts_link() ) { ?>
               <link rel="prev" href="<?php echo get_pagenum_link( $paged - 1 ); ?>">
               <?php
              }
             if ( get_next_posts_link() ) { ?>
               <link rel="next" href="<?php echo get_pagenum_link( $paged + 1 ); ?>">
               <?php
             }
       }
}
add_action( 'amp_post_template_head', 'amp_head_special');

It would need to go into the plugin itself of course for amp_post_template_head but I will leave that to the developers as to where it should go. There may be some other tests required due to the way static home pages and blogs are handled.

Frenchomatic commented 6 years ago

This explains why this needs to be released in the very next update - https://yoast.com/pagination-seo-best-practices/

hope the code above helps someone. Solved it for me.

shtefcs commented 6 years ago

Thanks for this code @Frenchomatic .

I hope Ahmed will include rel tags on search pagination as well.

@Frenchomatic are you wp developer? If yes, reach me on stefan@vanila.io.

Peace,

Frenchomatic commented 6 years ago

Was concerned that you were not excluding a static home page. I just tested your code and it works fine from features.php and does not get fired from the build of a static home page.

MohammedKaludi commented 6 years ago

Code pushed in 0.9.97.10, closing the ticket