Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Discussions > Google sitemaps (Archives - *read only*) > Perl site map generator (Unix)
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
pcunix@gmail.com  
View profile  
 More options Jun 4 2005, 2:08 pm
From: "[email address]"
Date: Sat, 04 Jun 2005 18:08:46 -0000
Local: Sat, Jun 4 2005 2:08 pm
Subject: Perl site map generator (Unix)
I've written the following - haven't yet seen Google approve of it's
output so it could have a bug, but still may be a place to start:

If it prints anything on the screen you have a potentially bad filename
and you'll need to add encoding code for it.. or skip it, or remove
it..

#!/usr/bin/perl
my $sitepath="/yourhtdocs";
my $website="http://yoursite.com";

chdir($sitepath);
@stuff=`find . -type f -name "*.html"`;
open(O,">sitemap");
print O <<EOF;
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
EOF
foreach (@stuff) {
 chomp;
 $badone=$_;
 $badone =~ tr/-_.\/a-zA-Z0-9//cd;
 print if ($badone ne $_);
 s/^..//;
$rfile="$sitepath/$_";
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize ,$blocks)=stat
$rfile;
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime($mtime);
$year +=1900;
$mon++;
$mod=sprintf("%0.4d-%0.2d-%0.2dT%0.2d:%0.2d:%0.2d+00:00",$year,$mon,$mday,$ hour,$min,$sec);
$mod=sprintf("%0.4d-%0.2d-%0.2d",$year,$mon,$mday);
$freq="monthly";
$freq="daily" if /index.html/;
$priority="0.5";
$priority="0.7" if /index.html/;
$priority="0.9" if /\/index.html/;

print O <<EOF;
<url>
      <loc>$website/$_</loc>
      <lastmod>$mod</lastmod>
      <changefreq>$freq</changefreq>
      <priority>$priority</priority>
</url>
EOF

}

print O <<EOF;
</urlset>
EOF
close O;
unlink("sitemap.gz");
system("gzip sitemap");

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
omniman@gmail.com  
View profile  
 More options Jun 5 2005, 6:30 am
From: "[email address]"
Date: Sun, 05 Jun 2005 10:30:27 -0000
Local: Sun, Jun 5 2005 6:30 am
Subject: Re: Perl site map generator (Unix)
Hi,

Appear internal server error.Why?

Regards,


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
pcunix@gmail.com  
View profile  
 More options Jun 6 2005, 6:55 pm
From: "[email address]"
Date: Mon, 06 Jun 2005 22:55:41 -0000
Local: Mon, Jun 6 2005 6:55 pm
Subject: Re: Perl site map generator (Unix)
Working fine for me, and Google has downloaded and approved the results
(12,583 pages).

Internal server error?  Did you try to run this as a cgi script?  It's
not - it's command line.  You could turn it into cgi if you want..


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »