Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yanick/catalyst-plugin-sitemap
Add sitemap support for your Catalyst application
https://github.com/yanick/catalyst-plugin-sitemap
catalyst perl sitemap
Last synced: 3 months ago
JSON representation
Add sitemap support for your Catalyst application
- Host: GitHub
- URL: https://github.com/yanick/catalyst-plugin-sitemap
- Owner: yanick
- License: other
- Created: 2010-09-28T00:16:13.000Z (over 14 years ago)
- Default Branch: releases
- Last Pushed: 2019-10-30T15:00:06.000Z (about 5 years ago)
- Last Synced: 2023-08-20T22:28:42.278Z (over 1 year ago)
- Topics: catalyst, perl, sitemap
- Language: Perl
- Homepage:
- Size: 53.7 KB
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.mkdn
- Changelog: Changes
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# NAME
Catalyst::Plugin::Sitemap - Sitemap support for Catalyst.
# VERSION
version 1.0.3
# SYNOPSIS
```perl
# in MyApp.pmuse Catalyst qw/ Sitemap /;
# in the controller
sub alone :Local :Sitemap {
...
}sub with_priority :Local :Sitemap(0.75) {
...
}sub with_args :Local
:Sitemap( lastmod => 2010-09-27, changefreq => daily ) {
...
}sub with_function :Local :Sitemap(*) {
...
}sub with_function_sitemap {
$_[2]->add( 'http://localhost/with_function' );
}# and then...
sub sitemap : Path('/sitemap') {
my ( $self, $c ) = @_;$c->res->body( $c->sitemap_as_xml );
}
```# DESCRIPTION
[Catalyst::Plugin::Sitemap](https://metacpan.org/pod/Catalyst::Plugin::Sitemap) provides a way to semi-automate the creation
of the sitemap of a Catalyst application.# CONTEXT METHOD
## sitemap()
Returns a [WWW::Sitemap::XML](https://metacpan.org/pod/WWW::Sitemap::XML) object. The sitemap object is populated by
inspecting the controllers of the application for actions with the
sub attribute `:Sitemap`.## sitemap\_as\_xml()
Returns the sitemap as a string containing its XML representation.
# `:Sitemap` Subroutine Attribute
The sitemap is populated by actions ear-marked with the <:Sitemap> sub
attribute. It can be invoked in different ways:- `:Sitemap`
```perl
sub alone :Local :Sitemap {
...
}
```Adds the url of the action to the sitemap.
If the action does not
resolves in a single url, this will results in an error.- `:Sitemap($priority)`
```perl
sub with_priority :Local :Sitemap(0.9) {
...
}
```Adds the url, with the given number, which has to be between 1 (inclusive)
and 0 (exclusive), as its priority.If the action does not
resolves in a single url, this will results in an error.- `:Sitemap( %attributes )`
```perl
sub with_args :Local
:Sitemap( lastmod => 2010-09-27, changefreq => daily ) {
...
}
```Adds the url with the given entry attributes (as defined by
[WWW::Sitemap::XML::URL](https://metacpan.org/pod/WWW::Sitemap::XML::URL)).If the action does not
resolves in a single url, this will results in an error.- `:Sitemap(*)`
```perl
sub with_function :Local :Sitemap(*) { }sub with_function_sitemap {
my ( $self, $c, $sitemap ) = @_;$sitemap->add( 'http://localhost/with_function' );
}
```Calls the function '_action_\_sitemap', if it exists, and passes it the
controller, context and sitemap objects.This is currently the only way to invoke `:Sitemap` on an action
resolving to many urls.# SEE ALSO
- [WWW::Sitemap::XML](https://metacpan.org/pod/WWW::Sitemap::XML)
Module that `Catalyst::Plugin::Sitemap` currently uses under the hood.
- [Search::Sitemap](https://metacpan.org/pod/Search::Sitemap)
Original module that this plugin was using under the hood.
- [Dancer::Plugin::SiteMap](https://metacpan.org/pod/Dancer::Plugin::SiteMap)
Similar plugin for the [Dancer](https://metacpan.org/pod/Dancer) framework, which inspired
`Catalyst::Plugin::Sitemap`.- [http://techblog.babyl.ca/entry/catalyst-plugin-sitemap](http://techblog.babyl.ca/entry/catalyst-plugin-sitemap)
Blog article introducing `Catalyst::Plugin::Sitemap`.
# AUTHOR
Yanick Champoux [![endorse](http://api.coderwall.com/yanick/endorsecount.png)](http://coderwall.com/yanick)
# COPYRIGHT AND LICENSE
This software is copyright (c) 2019, 2015, 2010 by Yanick Champoux.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.