Looking to hire Laravel developers? Try LaraJobs

laravel-robots-manager maintained by djstarcom

Description
Laravel robots.txt manager
Last update
2021/06/16 08:30 (dev-master)
License
Links
Downloads
2

Comments
comments powered by Disqus

Laravel robots.txt manager

Current Release Build Status Code Coverage Code Climate Test Coverage

Installation

First, install the package via composer:

composer require "djstarcom/laravel-robots-manager"

The package will automatically register itself.

Usage

Delete projects default public/robots.txt

Add the following to your routes file:

Route::get('robots.txt', function ()
{
    if (App::environment() == 'production') {
        // If on the live server, serve a nice, welcoming robots.txt.
        RobotsManager::addUserAgent('*');
        RobotsManager::addSitemap('sitemap.xml');
    } else {
        // If you're on any other server, tell everyone to go away.
        RobotsManager::addDisallow('*');
    }

    return Response::make(RobotsManager::generate(), 200, ['Content-Type' => 'text/plain']);
});

Refer to the RobotsManager.php for API usage.

License

MIT