Changing the title tag of 10,000 pages.

Discussion in 'HTML & Website Design' started by webmagnets, Jul 18, 2005.

  1. RectangleMan

    RectangleMan Notable Member

    Messages:
    2,825
    Likes Received:
    132
    Best Answers:
    0
    Trophy Points:
    210
    #21
    You can get php replace scripts that will work server side. I have one I can sell to you for $10.

    You upload the files then choose your actions and bingo...it runs server side. It's powerful and I 100% recommend you backup your files.
     
    RectangleMan, Jul 18, 2005 IP
  2. Perrow

    Perrow Well-Known Member

    Messages:
    1,306
    Likes Received:
    78
    Best Answers:
    0
    Trophy Points:
    140
    #22
    What, before doing a site wide search and replace, why?? :D
     
    Perrow, Jul 18, 2005 IP
  3. jimrthy

    jimrthy Guest

    Messages:
    283
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #23
    I might as well add into the mix. Let me see a sample page and I'll throw in a bid. Actually, this suggests (to me) a semi-useful tool that I might go ahead and write anyway.
     
    jimrthy, Jul 19, 2005 IP
  4. Discreet

    Discreet Guest

    Messages:
    550
    Likes Received:
    92
    Best Answers:
    0
    Trophy Points:
    0
    #24
    Here's the tricky way to do it:

    PERL
    1 - go into wordtracker and get a list of keywords from your market. You should be able to get 200 at least.
    2 - do the same from overture and the google keyword suggestion tool.
    3 - dump all the keywords into a database
    4 - using an ssh connection, go to your server's root directory where your html files are store and use the following command:

    find . -name "*.html" -print > pages.txt

    this will create a txt file listing every html page on your site.

    5 - perl script:

    open(INFILE, "pages.txt");
    @pages = <INFILE>;
    close(INFILE);
    while $pages(@pages) {
    SQL: select keywords from table order by rand() limit 3
    (this pulls 3 random keywords out of the list you generated)
    my $newfile;
    while $keywords {
    $newfile .= $keywords . "-";
    }
    $newfile .= ".html";
    mv $page $newfile;
    }

    Something like that. I know it's easier to do in a bash script, but that's getting a bit advanced for most users.

    This isn't actually as complicated as it looks. It shouldn't take you more than an hour to do :)

    BASH

    for i in `cat pages.txt`; do SED -iBAK 'regex command to replace titles'/g; done;

    Much smaller command if you get the syntax right, but it's very tricky to do.
     
    Discreet, Jul 20, 2005 IP
  5. webmagnets

    webmagnets Peon

    Messages:
    152
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #25
    This sounds promising. What do others think?
     
    webmagnets, Jul 20, 2005 IP
  6. Discreet

    Discreet Guest

    Messages:
    550
    Likes Received:
    92
    Best Answers:
    0
    Trophy Points:
    0
    #26
    The bash script would actually work alot better I think since you could do:

    's/common page title here/random page title here/g'

    The trick would be getting it to build a good random title with bash. Not sure entirely how to do that.

    You could order it to call a perl script that does the random file naming, and then takes that input into the bash script for each file and uses that for the random naming.

    Not too complicated, just tricky :)

    Also - the bash script would be safer. Using -iBAK on a sed command backs up the original file to file.html.BAK incase you need to revert it back :)


    There's actually an error in that perl code I did above. That will rename the file, not change the title lol. That would be bad! Chance the mv $file $newfile to exec("sed -iBAK 's/common title/$newfile/g' -$file") or something like that. Does the same thing the bash script does, so I'd say do it in bash :)
     
    Discreet, Jul 20, 2005 IP