andrewdanilov / yii2-sitemap
Component generates sitemap.xml for your models, controller actions or random pages.
Installs: 5
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- php: >=5.6.0
- ext-dom: *
- yiisoft/yii2: ~2.0.0
This package is auto-updated.
Last update: 2025-02-17 00:09:13 UTC
README
Component generates sitemap.xml for your models, controller actions or random pages.
Installation
The preferred way to install this extension is through composer.
Either run
composer require andrewdanilov/yii2-sitemap "~1.0.0"
or add
"andrewdanilov/yii2-sitemap": "~1.0.0"
to the require section of your composer.json
file.
Usage
Add component Sitemap to main config:
return [ ... 'components' => [ ... 'sitemap' => [ 'class' => andrewdanilov\sitemap\Sitemap, 'urls' => [ // Full notation for ActiveRecord model. // All found records will be collected for building sitemap. [ 'class' => 'frontend\models\Products', 'url' => ['catalog/product'], 'attribute' => 'id', // optional 'changeFreq' => andrewdanilov\sitemap\LocParams::WEEKLY, // optional 'priority' => 0.1, // optional 'lastMod' => 0, // optional ], // Full notation for single url/action. [ 'url' => ['catalog/index'], 'changeFreq' => andrewdanilov\sitemap\LocParams::WEEKLY, // optional 'priority' => 0.1, // optional 'lastMod' => 0, // optional ], // Short notation for single url/action ['catalog/index'], // Short notation for single random url 'category1/product123?page=2', ], ], ], ];