1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Smal sitemap cleanup script

Discussion in 'White Hat SEO' started by nil.ejman, Mar 5, 2011.

Tags:
  1. nil.ejman

    nil.ejman Registered Member

    Joined:
    Jan 14, 2011
    Messages:
    85
    Likes Received:
    11
    Hello friends,

    I've been submitting my sitemap to google for a while now. However, since I have some link trading scripts, my sitemap tool (I'm using GoDaddy sitemap "tool") has indexed a bunch of ugly urls, all of them related to link trading scripts. It sounded stupid to submit these urls to google, but I didn't know of a tool that could rid me of this.

    Until now, of course :)

    I'm attaching a script that does this for me. It's written in php, and is supposed to run from command line. I called it cleanSitemap, even though it's a stupid name :)

    If started without parameters, it will display usage instructions. Also, it takes care about some of the potential user errors like mistyping input file name and write errors.
    However, if your input xml file is badly formatted, it will crash.

    It also displays a small promotional message (only one line, I promise).

    So, here is usage instructions:

    USAGE: php cleanSitemap.php <input file> <output file> <bad str>
    This script parses <input file>, skipping all the sitemap XML elements containing <bad str>,
    writting only 'good' XML elements into sitemap.
    Sample: php cleanSitemap.php sitemap.xml sitemap_clean.xml protect-x


    I hope it helps!

    Cheers
     

    Attached Files:

  2. nil.ejman

    nil.ejman Registered Member

    Joined:
    Jan 14, 2011
    Messages:
    85
    Likes Received:
    11
    No one found this useful?

    I guess I'm the only one using plain sitemap generators and/or link sharing scripts. :)