WordPress.org

Ready to get started?Download WordPress

Forums

Guiding SearchBots (32 posts)

  1. carthik
    Member
    Posted 10 years ago #

    I have a problem with google returning my index page as the search result for serach strings that should actually return an entry that has "fallen off" the page. Also, since the main index page is searched, combinations of words from different posts leads google to beleive that there is something on the page that there actually isn't.
    A little bit of searching led me to This scribbling.net article on how to help the googlebot index better.
    Whats given below suggests a remedy to my problem :

    Webloggers: use the meta tags to help the Googlebot index only your permalinks, not your constantly changing front page. To do this, use
    <meta name="robots" content="noindex,follow" >
    on your front page and
    <meta name="robots" content="index,follow" >
    on your posts' permanent locations.

    I looked at the index.php page, and I am not sure how to change the meta tag, when there are no parameters (the plain index.php) and for when a particular post is being displayed.
    I would appreciate help and feedback with this problem.
    Thanks you,
    Carthik.

  2. OperaManiac
    Member
    Posted 10 years ago #

    maybe u can use ur robot file to block the index file from the spiders.
    but i am not sure if the permalinks will fool the spider and let them read the index file with parameters. not sure though.
    i would be interested to know if custom metatags for the home page and other pages is possible :)

  3. NuclearMoose
    Member
    Posted 10 years ago #

    Check out the info from the horse's mouth and learn about what Googlebot does and does not do. There are plenty of site devoted to helping you with your robot.txt file as well.

  4. carthik
    Member
    Posted 10 years ago #

    Thanks for all the pointers. I did check the google page, and read up on robots.txt and all that.
    <b>tcervo</b> -- Could you please elaborate on what "$p" means or does, I am sorry for being so ignorant about php. I was thinking along the same lines, -- of modifying the index.php with an if - else statement, but had no idea as to what to do. So yes, please let me know what the $p does/stands for.
    Thanks.

  5. Dougal Campbell
    Member
    Posted 10 years ago #

    The $p variable will contain the post_id when the current view is narrowed to a specific post. So the code above would tell robots to index individual post views, but not the main index page where there are multiple posts being shown.

  6. tcervo
    Member
    Posted 10 years ago #

    $p is a variable that holds the post id. So, when you go to an individual post page, $p should have the post id for that post. If it doesn't exist, then you're most likely not on an individual post page.
    I'm not sure how this works when using mod_rewrite (since I'm not using it), but I know it's passed as a URL parameter otherwise. So, you click on a permalink it should have $p={post_id} in the URl after the index.php....
    -Tony

  7. carthik
    Member
    Posted 10 years ago #

    Thanks tcervo & dougal.
    I think mod_rewrite should not be a problem, since apache would rewrite the request URL to the "normal" url with ?p , ?cat etc in it before it forwards the request to wordpress' engine, if I may call it that.
    I was about to ask you, "what about ?cat= , ?m= etc...?" which was a question I had earlier too, but I guess I found my answer, since I dont wont anything but individual pages to be returned as google search results.
    Just curious though, can you you do a
    if($p || $cat || $m)
    {where || stands for "OR"} ?
    how do you say if(anything-at-all) ? , that is, if there is any parameter at all, then say this in PHP?

  8. tcervo
    Member
    Posted 10 years ago #

    Just curious though, can you you do a
    if($p || $cat || $m)
    {where || stands for "OR"} ?

    Yes, absolutely...I use or (||) frequently.

  9. carthik
    Member
    Posted 10 years ago #

    I finally got it going, and it works just as expected, which I found out by viewing the source of the different pages (the indexpage, an individual entry page etc)
    Thanks tcervo!! I was getting a php parse error, which I fixed by using some of the other code in index.php as an example and guide :)
    Also for the index.php page, we want the bot to follow the links,
    So finally the code is ...
    <?php if ($p) {?>
    <meta name="robots" content="index,follow" />
    <?php
    }
    else
    {?>
    <meta name="robots" content="noindex,follow" /><?php
    }
    ?>
    Thanks y'all :)

  10. ByteWarrior
    Member
    Posted 10 years ago #

    I tried it too and here it works too! (I'm using mod_rewrite).
    Thanks for this neat piece of code!! :-)

  11. carthik
    Member
    Posted 10 years ago #

    Hi Sushubh,
    Refer to http://www.google.com/bot.html#noindextags
    So we have noindex, follow for the index page which means it wont be indexed but the links on it will still be followed.
    I hope that explains it.

  12. OperaManiac
    Member
    Posted 10 years ago #

    okie dokie! :)

  13. Anonymous
    Unregistered
    Posted 10 years ago #

    Might want to mention that upgrading your search engine profile may involve a whole lot more than adding META. I have WP running at home and am getting in shape to publish. I plan on making the max use of the H1 tag among other things to keep those bots coming.

  14. Anonymous
    Unregistered
    Posted 10 years ago #

    <meta name="robots" content="<?php echo (!isset($p)?'no':''); ?>index,follow" />

  15. Anonymous
    Unregistered
    Posted 10 years ago #

    feck... remove the isset, I'm so used to needing it.
    <meta name="robots" content="<?php echo (!$p?'no':''); ?>index,follow" />

  16. carthik
    Member
    Posted 10 years ago #

    It gets better and better!! :)

  17. Anonymous
    Unregistered
    Posted 10 years ago #

    If I only want to index the homepage and p=X pages, what sentence I need?
    This will work?

    <meta name="robots" content="<?php echo (!$cat || !$m || !$paged || !$s ?'':'no');?>index,follow" />

  18. carthik
    Member
    Posted 10 years ago #

    You could try putting that in the template and then viewing the source for the different types of index pages generated.
    My brain is a mess right now, else I would have figured out.

  19. stephenv
    Member
    Posted 10 years ago #

    in 1.2b this is now broken, please help.
    <meta name="robots" content="<?php echo (!$p?'no':''); ?>index,follow" />

  20. carthik
    Member
    Posted 10 years ago #

    What exactly is broken?

  21. carthik
    Member
    Posted 10 years ago #

    <meta name="robots" content="<?php if (!$p): ?>no<?php endif; ?> index,follow" />
    Should work.

  22. Beel
    Member
    Posted 10 years ago #

    Use $single instead of $p

  23. stephenv
    Member
    Posted 10 years ago #

    purrrrfect!
    Thanks Beel, that worked exactly as I needed.

  24. MaxT
    Member
    Posted 10 years ago #

    /me wonders why not index all permalinks AND the index page... I know, I've read whole thread from the start, still, more frequently updated page == bigger chance someone will find something from my site... and even if it have something indexed and it's too old, I have a google trap on my site which is displayed onlyto google users (something a-la please use search if you can't find what u're looking for at the main page)...
    Regards

  25. carthik
    Member
    Posted 10 years ago #

    Thanks for the heads-up Beel. I didn't know that before.

  26. Beel
    Member
    Posted 10 years ago #

    MaxT - It is just a matter of preference. When I google something I don't like going to pages that no longer contain the info for which I am looking and I will hit the back button to go back to my search list before doing another search which will return a very limited results, if any at all. Wouldn't any posts on the index page be properly "followed" from the links, so what is the point of indexing that page?

  27. MaxT
    Member
    Posted 10 years ago #

    I guess every person have a different opinion on it...

  28. Beel
    Member
    Posted 10 years ago #

    And here very few of us seem adverse to opining ;-)

  29. anatman
    Member
    Posted 9 years ago #

    Hi,
    i realized i have a problem with my blog and thought i would use this thread to ask about it, since it is related to search engines.
    The problem is the main subject of my site is taijiquan, which is a chinese word. Using an older but more popular transliteration system, it can be written "taichichuan", and there are more variations. But as i chose to refer to the subject by the current standart spelling, i am losing a lot of traffic.
    The meta keywords tag seems to have been practically deprecated by major engines, so i have been thinking about what i can do.
    Do you think that it would help to write the alternative spellings inside a spna, and hide then span with CSS?
    all help is much appreciated!

  30. Inglorion
    Member
    Posted 8 years ago #

    Sorry about bumping up ancient threads, but replying here puts things in context instead of making a new topic and having to explain everything all over again.

    My question is: Should I use '$p' or '$single' in WordPress 1.5.2? The various claims confused me.

    And what's with the '!'? Should I use that? What's the difference?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags