pieceofcake2 / sitemap
A CakePHP 2 Plugin for adding automatic XML and HTML Sitemaps to an app
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 15
Type:cakephp-plugin
pkg:composer/pieceofcake2/sitemap
Requires
- php: ^8.0
- composer/installers: *
- pieceofcake2/cakephp: ^2.10
Requires (Dev)
- cakephp/cakephp-codesniffer: ^5.0
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^9.6
- pieceofcake2/app: ^2.1
- pieceofcake2/phpstan-cakephp2: ^0.2.1
Replaces
- loadsys/cakephp_sitemap: ^1.0
README
This is forked for CakePHP2.
A CakePHP 2.x Plugin for adding automatic XML and HTML Sitemaps to an CakePHP app
Background
- Only generates a sitemap currently for models in the core App, not in Plugins.
- Generates an HTML list using a dl list.
- Generates an sitemap.xml file as well.
- View caching used for the HTML files.
- Allows for setting a custom callback function to build urls.
Requirements
- PHP 8.0+
- CakePHP 2.10+
Installation
Composer
$ composer require pieceofcake2/sitemap
Usage
- Add this this line to your
bootstrap.php
:
CakePlugin::load(['Sitemap' => ['routes' => true]]);
- Add the behavior to the model desired to generate a sitemap for that model
public $actsAs = [ 'Sitemap.Sitemap' => [ 'primaryKey' => 'id', // Default primary key field 'loc' => 'buildUrl', // Default function called that builds a url, passes parameters (Model $Model, $primaryKey) 'lastmod' => 'modified', // Default last modified field, can be set to FALSE if no field for this 'changefreq' => 'daily', // Default change frequency applied to all model items of this type, can be set to FALSE to pass no value 'priority' => '0.9', // Default priority applied to all model items of this type, can be set to FALSE to pass no value 'conditions' => [], // Conditions to limit or control the returned results for the sitemap ] ];
- Sitemap should now be visible at /sitemap and /sitemap.xml
Contributing
Reporting Issues
Please use GitHub Isuses for listing any known defects or issues.