Tools und Service ‹bersicht


#!/usr/bin/perl ############################################################### # sitemap.cgi (c) <hsulzer@t-online.de> (just copy and paste) # ############################################################### # http://www.newdy.org/service/sitemap-perlscript.html $svn = "$ENV{SERVER_NAME}"; &timer; print "Content-type: text/html\n\n"; print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; print "<urlset xmlns=\"http://www.google.com/schemas/sitemap/0.84\">\n"; $basedir = "../"; @files = !('*'); chdir($basedir); foreach $file(@files) { $ls = `ls $file`; @ls = split(/\s+/,$ls); foreach $filename(@ls) { if($filename =~ /cgi|images|xml|txt|skip-these/g) { next; } else { if($filename =~ /index|handys|log|most-important/g) { $pri = "1.0"; $fre = "daily"; } else { $pri = "0.5"; $fre = "weekly"; } print " <url>\n"; print " <loc>http://$svn\/$filename</loc>\n"; print " <lastmod>$ltm</lastmod>\n"; print " <changefreq>$fre</changefreq>\n"; print " <priority>$pri</priority>\n"; print " </url>\n"; } }; print "</urlset>"; } exit(0); #endmain###### ######### sub timer ######### { $ltm = localtime(); @ltm = split(' ',$ltm); $mon = @ltm[1]; if($mon eq "Jan") {$mon = "01"}; if($mon eq "Feb") {$mon = "02"}; if($mon eq "Mar") {$mon = "03"}; if($mon eq "Apr") {$mon = "04"}; if($mon eq "May") {$mon = "05"}; if($mon eq "Jun") {$mon = "06"}; if($mon eq "Jul") {$mon = "07"}; if($mon eq "Aug") {$mon = "08"}; if($mon eq "Sep") {$mon = "09"}; if($mon eq "Oct") {$mon = "10"}; if($mon eq "Nov") {$mon = "11"}; if($mon eq "Dec") {$mon = "12"}; $day = @ltm[2]; if($day < 10) { $day = "0" . $day; }; $ltm = @ltm[4].'-'.$mon.'-'.$day; } #end sub date_timer #endall####### # source sitemap.xml: # <!--#exec cgi="cgi-bin/sitemap.cgi"-->