sergeybruhin / dynamic-robots
Laravel Dynamic Robots Package
Requires
- php: ^7.4|^8.0
Requires (Dev)
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-11-16 23:12:49 UTC
README
Very basic and simple package to show different robots.txt files for different environments. Just create new directory and create there blade files with environment names. That's it!
Installation
You can install the package via composer:
composer require sergeybruhin/dynamic-robots
Publish Config
php artisan vendor:publish --provider="SergeyBruhin\DynamicRobots\Providers\DynamicRobotsServiceProvider"
Set robots blade files directory
If you want to change robots.txt for production environment just add production.blade.php with robots.txt content to resources/views/robots.
return [ /** * Custom robots blade files directory prefix without trailing dot * eg: robots * If empty, default robots.txt from package will be used */ 'directory' => 'robots', ];
Create Default robots.txt
If there are no blade file for current environment, default.blade.php will be used. So don't forget to create it in /resources/views/{your-directory}!
Default robots.txt from package if user robots.txt not exists
User-agent: *
Disallow: /admin/*
Disallow: /nova/*
⚠️ If you have robots.txt in public folder don't forget to delete it!
Testing (Not yet 💁♂️)
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
ToDo
- Add ability to programmatically change robots files
- Add ability to set default rule set via config
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email sundaycreative@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.