Skip to content

Optimizes your site's robots.txt to reduce server load and CO2 footprint by blocking unnecessary crawlers while allowing major search engines and specific tools.

License

Notifications You must be signed in to change notification settings

Emilia-Capital/eco-friendly-robots-txt

CS Lint PHP

Eco-Friendly Robots.txt

Optimizes your site's robots.txt to reduce server load and CO2 footprint by blocking unnecessary crawlers while allowing major search engines and specific tools.

Test this plugin on the WordPress playground

Installation

Warning

The plugin will delete your existing robots.txt file, if one exists on your server, although it'll try to back it up. It'll restore it, when it can, when you uninstall the plugin.

Default output

The default output of this plugin can be seen here on joost.blog or here on emilia.capital.

Filters

The plugin exposes the following filters:

  • emilia/ecofriendly_robots/allowed_spiders - filter an array of user agents.
  • emilia/ecofriendly_robots/blocked_paths - filters an array of blocked paths.
  • emilia/ecofriendly_robots/allowed_paths - filters an array of allowed paths, should be subsets of blocked_paths.
  • emilia/ecofriendly_robots/output - filters the entire output as a string.

Development

If you're developing on this plugin, you will probably want to run tests and lint. You can do that by running the following commands:

  • PHP Code style: composer check-cs
  • PHP Autofixer for code style: composer fix-cs
  • PHP Lint: composer lint
  • PHP Unit tests: composer test

About

Optimizes your site's robots.txt to reduce server load and CO2 footprint by blocking unnecessary crawlers while allowing major search engines and specific tools.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Languages