The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
#!/usr/bin/perl

package Main;
$Main::VERSION = '0.040';
# PODNAME: koha-sitemap
# ABSTRACT: Creates sitemap files for a whole Koha DB

use 5.010;
use utf8;
use strict;
use warnings;
use Carp;
use Pod::Usage;
use Getopt::Long;
use Koha::Contrib::Tamil::Sitemaper;


my $verbose     = 0;
my $help        = 0;
my $url         = '';
GetOptions( 
    'verbose'   => \$verbose,
    'help'      => \$help,
    'url=s'     => \$url,
);

sub usage {
    pod2usage( -verbose => 2 );
    exit;
} 


usage() if $help || !$url;          

my $sitemaper = Koha::Contrib::Tamil::Sitemaper->new( 
    verbose => $verbose,
    url     => $url,
);
$sitemaper->run(); 

__END__

=pod

=encoding UTF-8

=head1 NAME

koha-sitemap - Creates sitemap files for a whole Koha DB

=head1 VERSION

version 0.040

=head1 DESCRIPTION

Process all biblio records from a Koha instance and generate Sitemap files
complying with this protocol as described on L<http://sitemaps.org>. The goal of
this script is to be able to provide to search engines direct access to biblio
records. It avoid leaving search engine browsing Koha OPAC and so generating
a lot of traffic, and workload, for a bad result. 

A file name F<sitemapindex.xml> is generated. It contains references to Sitemap
multiples files. Each file contains at most 50,000 urls, and is named
F<sitemapXXXX.xml>.

The files must be stored on Koha OPAC root directoty, ie
F<<koha-root>/koha-tmpl/>. Place also in this directory a F<robots.txt> file
like this one:

 Sitemap: sitemapindex.xml
 User-agent: *
 Disallow: /cgi-bin/

=head1 USAGE

=over

=item koha-sitemap [--verbose|--help] --url=F<Koha OPAC base URL> 

=back

=head1 PARAMETERS

=over

=item B<--url=Koha OPAC base URL>

=item B<--verbose|-v>

Enable script verbose mode. 

=item B<--help|-h>

Print this help page.

=back

=head1 AUTHOR

Frédéric Demians <f.demians@tamil.fr>

=head1 COPYRIGHT AND LICENSE

This software is Copyright (c) 2015 by Fréderic Démians.

This is free software, licensed under:

  The GNU General Public License, Version 3, June 2007

=cut