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: "[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.
You do not have the permission required to post.
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,
[email address] wrote:
> 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.
You do not have the permission required to post.
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.
You do not have the permission required to post.