NAME

Dancer::Plugin::SiteMap - Automated site map for the Dancer web framework.

SYNOPSIS

    use Dancer;
    use Dancer::Plugin::SiteMap;

Yup, its that simple. Optionally you can omit routes by passing a list of regex patterns to be filtered out.:

    sitemap_ignore( 'ignore/this/route', 'orthese/.*' );

    # you can make several calls to sitemap_ignore, the new patterns
    # will be added without removing the old ones.
    sitemap_ignore( '/other/route' );

Note that your specified routes will be tied to the beginning of the route, so if you say sitemap_ignore('/path') then the sitemap will exclude routes like '/path', but not '/some/other/path'.

You may also tell this plugin to omit all routes disallowed in robots.txt. In the config.yml of the application:

    plugins:
        SiteMap:
            robots_disallow: /local/path/to/robots.txt

Should you require more HTML around the sitemap, for styling / structure purposes, you can define the config option html_template. If this key is present the sitemap will try to render within the template view named. That view should be created in the location of your app's views setting as with any other template and contain at least a <% sitemap %> token.

    plugins:
        SiteMap:
            html_template: 'mysitemap_template.t'

    ---
    <div class="extra_thing">
    <% sitemap %>
    </div>
    ---

Finally, you can change the default route for the sitemap by adding fields to the plugin config. It's worth noting that this must be a full route path, ie. start with a slash. Having a route option in the config but with no value will disable that particular sitemap.

eg, in the config.yml of the application:

    plugins:
        SiteMap:
            xml_route: '/sitemap_static.xml'
            html_route:                           # html sitemap is disabled.

DESCRIPTION

This plugin now supports Dancer 1 and 2!

Plugin module for the Dancer web framwork that automagically adds sitemap routes to the webapp. Currently adds /sitemap and /sitemap.xml where the former is a basic HTML list and the latter is an XML document of URLS.

Currently it only adds staticly defined routes for the GET method.

Using the module is literally that simple... 'use' it and your app will have a site map.

The HTML site map list can be styled throught the CSS class 'sitemap'

Added additional functionality in 0.06 as follows:

Firstly, fixed the route selector so the sitemap doesn't show the "or not" operator ('?'), any route defined with a ':variable' in the path or a pure regexp as thats just dirty.

More importantly, I came across the requirement to not have a few admin pages listed in the sitemap, so I've added the ability to tell the plugin to ignore certain routes via the sitemap_ignore keyword.

AUTHOR

James Ronan, <james at ronanweb.co.uk>

CONTRIBUTORS

Many thanks to the following guys for adding features (and tests!) to this plugin:

Breno G. de Oliveira, GARU <garu at cpan.org>

David Pottage, SPUDSOUP <spudsoup at cpan.org>

Xavier Caron, XAV <xav at cpan.org>

BUGS

Please report any bugs or feature requests to the web interface at https://github.com/jamesronan/Dancer-Plugin-SiteMap/issues. Alternatively, you can also use the CPAN RT request tracker at http://rt.cpan.org/NoAuth/Bugs.html?Dist=Dancer-Plugin-SiteMap

Pull Requests are welcome for bug fixes and features alike. The plugin is under version control on GitHub at: https://github.com/jamesronan/Dancer-Plugin-SiteMap

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Dancer::Plugin::SiteMap

You can also look for information at:

LICENSE AND COPYRIGHT

Copyright 2010-2014 James Ronan.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.