Skip to content
Browse files

companies siteindex

  • Loading branch information...
1 parent 9053a25 commit 6ff394be7c4292db718f72f36202a2d74e84a07f @fayland committed May 3, 2012
Showing with 21 additions and 22 deletions.
  1. +21 −22 cron/tools/sitemap.pl
View
43 cron/tools/sitemap.pl
@@ -22,28 +22,12 @@
## an index with 4 files, jobs, freelancer, tags and companies
my $index = WWW::SitemapIndex::XML->new();
-$index->add(
- loc => $config->{sites}->{main} . '/sitemap.jobs.xml.gz',
- lastmod => $today,
-);
-$index->add(
- loc => $config->{sites}->{main} . '/sitemap.freelances.xml.gz',
- lastmod => $today,
-);
-$index->add(
- loc => $config->{sites}->{main} . '/sitemap.tags.xml.gz',
- lastmod => $today,
-);
-
-=pod
-
-$index->add(
- loc => $config->{sites}->{main} . '/sitemap.companies.xml.gz',
- lastmod => $today,
-);
-
-=cut
-
+foreach my $t ('jobs', 'freelances', 'tags', 'companies') {
+ $index->add(
+ loc => $config->{sites}->{main} . "/sitemap.$t.xml.gz",
+ lastmod => $today,
+ );
+}
$index->write("$dir/sitemap.xml.gz");
# sitemaps.jobs.xml.gz
@@ -105,6 +89,21 @@
}
$map->write("$dir/sitemap.tags.xml.gz");
+# sitemap.companies.xml.gz
+$map = WWW::Sitemap::XML->new();
+$rs = $schema->resultset('Company')->search( undef, {
+ rows => 10000,
+ page => 1
+} );
+while (my $r = $rs->next) {
+ my $url = $config->{sites}->{main} . $r->url;
+ $map->add(
+ loc => $url,
+ priority => 0.5,
+ );
+}
+$map->write("$dir/sitemap.companies.xml.gz");
+
# add ping
LWP::UserAgent->new->get( "http://www.google.com/webmasters/tools/ping?sitemap=" . uri_escape($config->{sites}->{main} . '/sitemap.xml.gz') );

0 comments on commit 6ff394b

Please sign in to comment.
Something went wrong with that request. Please try again.