sitemapgenerator sitemap.xml generator

  1. Requirements
  2. Links
  3. Adding URLs to sitemap.xml
  4. Updates

Generates sitemap.xml file by docComment mark @sitemap for Yii controllers actions. Has lots of options, built-in URL-parsers for CActiveRecord and CViewAction, allows dynamic creation of urls.


  • Yii 1.1.8 (other versions not tested).
  • PHP 5.2 or later.
  • PHP Reflection extension.
  • PHP SimpleXML extension.


Adding URLs to sitemap.xml

Single URL

To add single url by action route just add @sitemap comment:

 * @sitemap
public function actionIndex() { ... }

For more functional adding of URLs please see adding URLs wiki page.


2011/10/25 - v0.81a

  • Small bugfixes: php5.2 support for custom models URLs parser by name, and strict mode errors.

2011/10/17 - v0.8a

  • Warning: NO backward compatibility for previous versions. Lots of changes in code. If you want to upgrade from previous version, please reinstall extension. See Installation wiki page. Already added @sitemap marks will work fine with new version.
  • All configuration moved to config/main.php. Sitemap files are now rendered through own separate controller (no need for code in other controllers except for adding URLs).
  • Added caching support. wiki
  • Added flexible pre-import support. wiki
  • Added support of multiple @sitemap marks in single method doc-comment.
  • Added built-in parsers for adding CActiveRecord models and CActionView files. Wiki pages: CActiveRecord-based URLs and CViewAction view files.
  • Added support for 'yiic messages' and russian messages file (mostly contains exception messages).

2011/10/09 - v0.7a

  • Added to google code. Most of description (which became to large for single extension page) moved to wiki pages. See links section.
  • Added CBaseUrlRule class file for handling routes and CAction class file for handling sitemap action. New installation and configuration became even more easily, especially for multiple sitemap files.
  • Aliases now can be specified as comma-separated string.
  • Added configuration option for route structure. Before that it was by default 'application,modules,controllers'.
  • lastmod attribute now can be specified by unix timestamp integer(!) value. Can be useful while using PHPs time(), filemtime() and other functions.
  • Small bugfixes.
  • Full backward compatibility.

2011/10/04 - v0.6a

  • Aliases now can be specified to directories of controllers and also to exact controllers files. Example: $aliases=array('application.controllers.SiteController');

  • Added support for multiple sitemap.xml files. See description for examples. Protocol details: sitemap index file.

  • Max urls limited to 50000 per single sitemap.xml file. Link: sitemap size Filesize are not checked due to different php settings of data compressing (zlib extension and etc.). If there is serious probability that file size will exceed 10mb, then you will need to create several sitemap files with sitemap index.

  • Forced conversion datetime's ('lastmod' attribute) to W3C datetime format. Source datetime must be specified in valid datetime format. Timezone must be set in given datetime. If it's not, then will be used default timezone (or you can set it with php function date_default_timezone_set()). Details.

  • Fixed: Urls with GET params are now escaped. Link: Sitemap url escaping

  • Added SitemapGenerator::renderAsGz() If by any reason zlib doesn't make buffer output auto-gz-encoding, you can use SitemapGenerator::renderAsGz() method, which is clone of SitemapGenerator::render(), but with forced gzencoding.

  • To render() methods added headers for browser caching disabling and error exception handling.

2011/10/03 - v0.51a

  • fixed PHP 5.2 support.
8 0
1 621 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: Others
Tags: sitemap, XML
Developed by: Evgeny L
Created on: Oct 1, 2011
Last updated: 11 years ago


show all

Related Extensions