I've read through many posts to try and find a solution to my problem, but was unsuccessful. Here's what I'm trying to accomplish:
I'm trying to force Google to index my multi-page/pagination posts. In order to do so, I need to have the rel='prev' and rel='next' links pointing to the next PAGE in the post - not the next new post. I realize Yoast's plugin will do the trick, but I don't need all the extra bloat that comes with it so I would like to make this happen without it. So, I found some information on StackExchange (http://wordpress.stackexchange.com/questions/84647/multi-page-posts-do-not-get-indexed-by-google-due-to-canonical-urls), but I'm unclear where I should add this code. I tried creating a new plugin from the code and also adding it to the canocial.php file, but line 21 in the code throws an error each time.
Could anyone assist me on how to implement rel='prev' and rel='next' links. Below is an example of what I need to happen for each post:
Let's say I have a pagination post with 4 pages with titles such as this:
Now let's say the reader is on page number 2. I would like to have the following rel='prev' and rel='next' links in the code pointing to these links like the following:
<link rel="prev" href="http://www.mysite.com/2013/03/25/blog-title/">
<link rel="next" href="http://www.mysite.com/2013/03/25/blog-title/3/">
If on the last page, #4, there should be a rel='prev' link pointing to this:
<link rel="prev" href="http://www.mysite.com/2013/03/25/blog-title/3/">
Currently, my rel='prev' and rel='next' links point to new/old blog posts outside the pagination so that is killing my SEO. Google will not index because the canonical link as well as the rel='prev' and rel='next' links point to the incorrect destination. I have removed the canonical altogether, but that still didn't help.
Any help would be greatly appreciated. I've been struggling with this for a while.