WWW::Sitemap::Simple - simple sitemap builder
use WWW::Sitemap::Simple; my $sm = WWW::Sitemap::Simple->new; # simple way $sm->add('http://example.com/'); # with params $sm->add( 'http://example.com/foo' => { lastmod => '2005-01-01', changefreq => 'monthly', priority => '0.8', }, ); # set params later my $key = $sm->add('http://example.com/foo/bar'); $sm->add_params( $key => { lastmod => '2005-01-01', changefreq => 'monthly', priority => '0.8', }, ); $sm->write('sitemap/file/path');
WWW::Sitemap::Simple is the builder of sitemap with less dependency modules.
The Sitemap protocol: http://www.sitemaps.org/protocol.html
constractor. There are optional parameters below.
If you add URLs more than 50,000 or generated XML file size over 10MB, then it will croak error.
add new url. return an id(md5 hex string).
add parameters to url by id
get an id for calling add_params method.
write sitemap. By default, put sitemap to STDOUT.
get or set the urlset attribute as hash.
my $sm = WWW::Sitemap::Simple->new; $sm->urlset({ 'xmlns' => "http://www.sitemaps.org/schemas/sitemap/0.9", 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd', });
get or set indent strings
get or set boolean value for croaking
get all url hash lists
get a count of url
Your Sitemap must be UTF-8 encoded (you can generally do this when you save the file). As with all XML files, any data values (including URLs) must use entity escape codes for the characters.
see more detail: http://www.sitemaps.org/protocol.html#escaping
WWW::Sitemap::Simple is hosted on github: http://github.com/bayashi/WWW-Sitemap-Simple
Welcome your patches and issues :D
Dai Okabayashi <bayashi@cpan.org>
WWW::Sitemap::XML
Web::Sitemap
Search::Sitemap
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
To install WWW::Sitemap::Simple, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Sitemap::Simple
CPAN shell
perl -MCPAN -e shell install WWW::Sitemap::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.