The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WWW::Sitemap::XML::URL - XML Sitemap url entry

VERSION

version 2.01

SYNOPSIS

    my $url = WWW::Sitemap::XML::URL->new(
        loc => 'http://mywebsite.com/',
        lastmod => '2010-11-26',
        changefreq => 'always',
        priority => 1.0,
    );

XML output:

    <?xml version="1.0" encoding="UTF-8"?>
    <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
       <url>
          <loc>http://mywebsite.com/</loc>
          <lastmod>2010-11-26</lastmod>
          <changefreq>always</changefreq>
          <priority>1.0</priority>
       </url>
    </urlset>

Google sitemap video, image and mobile extensions:

    my $url2 = WWW::Sitemap::XML::URL->new(
        loc => 'http://mywebsite.com/',
        lastmod => '2010-11-26',
        changefreq => 'always',
        priority => 1.0,
        mobile => 1,
        images => [
            {
                loc => 'http://mywebsite.com/image1.jpg',
                caption => 'Caption 1',
                title => 'Title 1',
                license => 'http://www.mozilla.org/MPL/2.0/',
                geo_location => 'Town, Region',
            },
            {
                loc => 'http://mywebsite.com/image2.jpg',
                caption => 'Caption 2',
                title => 'Title 2',
                license => 'http://www.mozilla.org/MPL/2.0/',
                geo_location => 'Town, Region',
            }
        ],
        videos => [
            content_loc => 'http://mywebsite.com/video1.flv',
            player => {
                loc => 'http://mywebsite.com/video_player.swf?video=1',
                allow_embed => "yes",
                autoplay => "ap=1",
            }
            thumbnail_loc => 'http://mywebsite.com/thumbs/1.jpg',
            title => 'Video Title 1',
            description => 'Video Description 1',
        ]

    );

XML output:

    <?xml version="1.0" encoding="UTF-8"?>
    <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0"
        xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
        xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
       <url>
          <loc>http://mywebsite.com/</loc>
          <lastmod>2010-11-26</lastmod>
          <changefreq>always</changefreq>
          <priority>1.0</priority>
          <mobile:mobile/>
          <image:image>
             <image:loc>http://mywebsite.com/image1.jpg</image:loc>
             <image:caption>Caption 1</image:caption>
             <image:title>Title 1</image:title>
             <image:license>http://www.mozilla.org/MPL/2.0/</image:license>
             <image:geo_location>Town, Region</image:geo_location>
          </image:image>
          <image:image>
             <image:loc>http://mywebsite.com/image2.jpg</image:loc>
             <image:caption>Caption 2</image:caption>
             <image:title>Title 2</image:title>
             <image:license>http://www.mozilla.org/MPL/2.0/</image:license>
             <image:geo_location>Town, Region</image:geo_location>
          </image:image>
          <video:video>
             <video:content_loc>http://mywebsite.com/video1.flv</video:content_loc>
             <video:title>Video Title 1</video:title>
             <video:description>Video Description 1</video:description>
             <video:thumbnail_loc>http://mywebsite.com/thumbs/1.jpg</video:thumbnail_loc>
             <video:player_loc allow_embed="yes" autoplay="ap=1">http://mywebsite.com/video_player.swf?video=1</video:player_loc>
          </video:video>

       </url>
    </urlset>

DESCRIPTION

WWW::Sitemap::XML::URL represents single url entry in sitemap file.

Class implements WWW::Sitemap::XML::URL::Interface.

ATTRIBUTES

loc

URL of the page.

isa: "Location" in WWW::Sitemap::XML::Types

Required.

lastmod

The date of last modification of the page.

isa: "DateTimeW3C" in MooseX::Types::DateTime::W3C

Optional.

changefreq

How frequently the page is likely to change.

isa: "ChangeFreq" in WWW::Sitemap::XML::Types

Optional.

priority

The priority of this URL relative to other URLs on your site.

isa: "Priority" in WWW::Sitemap::XML::Types

Optional.

images

Array reference of images on page.

Note: This is a Google sitemap extension.

isa: "ArrayRefOfImageObjects" in WWW::Sitemap::XML::Types

Optional.

videos

Array reference of videos on page.

Note: This is a Google sitemap extension.

isa: "ArrayRefOfVideoObjects" in WWW::Sitemap::XML::Types

Optional.

mobile

Flag indicating that page serves feature phone content.

A mobile sitemap must contain only URLs that serve feature phone web content. All other URLs are ignored by the Google crawling mechanisms so, if you have non-featurephone content, create a separate sitemap for those URLs.

Note: This is a Google sitemap extension.

isa: Bool

Optional.

METHODS

as_xml

Returns XML::LibXML::Element object representing the <url> entry in the sitemap.

SEE ALSO

http://www.sitemaps.org/protocol.php

WWW::Sitemap::XML::Google::Image

WWW::Sitemap::XML::Google::Video

https://support.google.com/webmasters/answer/183668

AUTHOR

Alex J. G. Burzyński <ajgb@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Alex J. G. Burzyński <ajgb@cpan.org>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.