Skip to content
Yii extension for generating Sitemaps
PHP
Branch: master
Clone or download
Latest commit 45344c2 Oct 20, 2015
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config
vendors/php-dom Added the project files Oct 19, 2015
LICENSE Initial commit Oct 19, 2015
README.md
SitemapCommand.php
SitemapComponent.php

README.md

YiiSitemapGenerator

The project brings the sitemap generator based on the website crawler. It is made for Yii 1.1.x. Was not tested and not intended to work on 2.x It is related on PHP Simple HTML DOM Parser (http://simplehtmldom.sourceforge.net/) More about sitemaps: http://www.sitemaps.org/protocol.html

How To use

To use the generator, add the SitemapComponent.php to your protected/components Copy the php-dom folder to protected/vendors (or download the newest version from the project website). Add configuration following in the protected/config/console.php:

'sitemap'=>array(
  'class'=>'SitemapComponent',
    'protocolPattern'=>'https',
    'sitemapPath'=>'/var/www/mypage'
    'excludeRegex'=>array(
      //sample exclude the wp-* folders, if we also host w WordPress blog,
      //and don't want to include this URLS to the sitemaps.
      '/^(.*)wp-(.*)$/',
    ),

To run the sitemap generation run:

  Yii::app()->sitemap->generateSitemap();

The parameters are explained in the comments in the code. The sample configuration file and command is attached with the project.

TODO

Add the last modification date to the sitemap.

Add urlencoding

Add Escapes of characters: & ' " < >

You can’t perform that action at this time.