nyx-solutions / yii2-nyx-robots
Yii2 Robots.txt Generator Module
5.0.0
2022-06-02 14:55 UTC
Requires
- php: >=8.1.0 <8.2
- nyx-solutions/yii2-nyx: ~5.0.0
- nyx-solutions/yii2-nyx-helpers: ~5.0.0
- nyx-solutions/yii2-nyx-mvc: ~5.0.0
README
Yii2 Module for automatically generating the robots.txt file.
Installation
The preferred way to install this extension is through composer.
- Either run
php composer.phar require --prefer-dist "nyx-solutions/yii2-nyx-robots" "*"
or add
"nyx-solutions/yii2-nyx-robots": "*"
to the require
section of your application's composer.json
file.
Usage
- Configure the
cache
component of your application's configuration file, for example:
'components' => [ 'cache' => [ 'class' => 'yii\caching\FileCache', ], ]
- Add a new module in
modules
section of your application's configuration file, for example:
'modules' => [ 'robots' => [ 'class' => 'nyx\modules\robots\Module', 'settings' => [ 'disallowAllRobots' => false, 'allowAllRobots' => false, 'useSitemap' => true, 'sitemapFile' => '/sitemap.xml', 'robots' => [], 'allowRules' => [ 'all' => [ '/uploads' ] ], 'disallowRules' => [ 'all' => [ '/assets' ] ] ] ] ]
- Add a new rule for
urlManager
of your application's configuration file, for example:
'urlManager' => [ 'rules' => [ ['pattern' => 'robots', 'route' => 'robots/default/index', 'suffix' => '.txt'], ] ]
License
yii2-nyx-robots is released under the BSD 3-Clause License. See the bundled LICENSE.md
for details.