Search::Sitemap::Index - Perl extension for managing Sitemap Indexes


Search-Sitemap documentation Contained in the Search-Sitemap distribution.

Index


Code Index:

NAME

Top

Search::Sitemap::Index - Perl extension for managing Sitemap Indexes

SYNOPSIS

Top

  use Search::Sitemap::Index;

  my $index = Search::Sitemap::Index->new();
  $index->read( 'sitemap-index.gz' );

  $index->add( Search::Sitemap::URL->new(
    loc     => 'http://www.jasonkohles.com/sitemap1.gz',
    lastmod => '2005-11-01',
  ) );

  $index->write( 'sitemap-index.gz' );

DESCRIPTION

Top

A sitemap index is used to point search engines at your sitemaps if you have more than one of them.

METHODS

Top

Search::Sitemap::Index inherits all the methods found in Search::Sitemap.

MODULE HOME PAGE

Top

The home page of this module is http://www.jasonkohles.com/software/Search-Sitemap. This is where you can always find the latest version, development versions, and bug reports. You will also find a link there to report bugs.

SEE ALSO

Top

Search::Sitemap

Search::Sitemap::Ping

http://www.jasonkohles.com/software/Search-Sitemap

http://www.sitemaps.org/

AUTHOR

Top

Jason Kohles, <email@jasonkohles.com>

COPYRIGHT AND LICENSE

Top


Search-Sitemap documentation Contained in the Search-Sitemap distribution.

package Search::Sitemap::Index;
use strict; use warnings;
our $VERSION = '2.13';
our $AUTHORITY = 'cpan:JASONK';
use Moose;
extends 'Search::Sitemap';
use MooseX::ClassAttribute;
use MooseX::Types::Moose qw( ArrayRef );
use Search::Sitemap::Types qw( SitemapURL XMLPrettyPrintValue );
use namespace::clean -except => 'meta';

class_has '+base_element' => ( default => 'sitemapindex' );
class_has '+url_type'   => ( default => 'sitemap' );
class_has '+url_fields' => ( default => sub { [qw( loc lastmod )] } );

around '_build_xml_headers' => sub {
    my $next = shift;
    my $headers = $next->( @_ );
    $headers->{ 'xsi:schemaLocation' } =~ s/sitemap\.xsd$/siteindex.xsd/;
    return $headers;
};

__PACKAGE__->meta->make_immutable;
1;
__END__