Forums

Stop spiders from indexing past first page (9 posts)

  1. dlawton
    Member
    Posted 6 months ago #

    Just wondering if this is possible. I want to (for example) remove this page from google:
    http://superstoker.com/page/2/

    However, I want the links on this page (specifically the posts) to be indexed. The problem is that Google is landing people on these pages, and they seem quite out of context in my site's current design.

    Possible? Bad idea? Any thoughts greatly appreciated.

  2. Ornani
    Member
    Posted 6 months ago #

    You can use a rel="noindex" on the pages hyperlinks, this can be done with the theme.

  3. dlawton
    Member
    Posted 6 months ago #

    no sure how to do it, im using pagenavi plugin for links to additional pages, i guess i will refer to the plugin support for help adding in additional tags to the links

    thanks though, i was heading in the wrong direction trying to actually make the page noindex/nofollow as opposed to the link to it

  4. Ornani
    Member
    Posted 6 months ago #

    try to edit wp-pagenavi.php file and add to every
    echo '<a href=
    a rel="noindex" attribute.

    e.g.:
    echo '<a href="'.clean_url(get_pagenum_link()).'" title="'.$first_page_text.'"> '.$first_page_text.' </a>';
    into
    echo '<a href="'.clean_url(get_pagenum_link()).'" title="'.$first_page_text.'" rel="noindex"> '.$first_page_text.' </a>';

  5. dlawton
    Member
    Posted 6 months ago #

    great, working fine, thanks!

    however, I realized I have a new problem. On page 2 (and every other page), I now have a pagenavi link going back to page 1, which is now marked as noindex. What will the effect be of doing this? Will spiders ignore this since page 2 is noindex anyway? Obviously the spider isn't going to stop indexing page 1, because it's the homepage, so is there any reason not to do this?

    cheers

  6. Ornani
    Member
    Posted 6 months ago #

    I don't think thats a big problem but just to be sure u can try to change
    echo '<a href="'.clean_url(get_pagenum_link()).'" title="'.$first_page_text.'"> '.$first_page_text.' </a>';
    back.

  7. dlawton
    Member
    Posted 6 months ago #

    didn't work unfortunately, thanks for the help Ornani

  8. dlawton
    Member
    Posted 6 months ago #

    i solved it by taking out the noindex for the first_page_text (as suggested), this ensured when you are on the last page for example, the link to the 'first page' is indexed.

    next, i replaced this:
    echo '<a href="'.clean_url(get_pagenum_link($i)).'" title="'.$page_text.'"> '.$page_text.' </a>';

    with this:

    if ($i == $start_page){echo '<a href="'.clean_url(get_pagenum_link($i)).'" title="'.$page_text.'"> '.$page_text.' </a>';}
    else{echo '<a href="'.clean_url(get_pagenum_link($i)).'" title="'.$page_text.'" rel="noindex"> '.$page_text.' </a>';}

    Then I found that the next and previous links were still indexing pages past the first page (The << and >> links) so I just removed these completely by deleting these lines:
    next_posts_link($pagenavi_options['next_text'], $max_page);
    previous_posts_link($pagenavi_options['prev_text']);

  9. De-Ard
    Member
    Posted 1 month ago #

    Don't forget to add rel="noindex" for the last page link

    echo '<a href="'.clean_url(get_pagenum_link($max_page)).'" title="'.$last_page_text.'" rel="noindex">'.$last_page_text.'</a>';

Reply

You must log in to post.

About this Topic