bnomei / kirby3-robots-txt
Manage the robots.txt from the Kirby config file
Fund package maintenance!
bnomei
Patreon
buymeacoff.ee/bnomei
paypal.me/bnomei
Installs: 19 443
Dependents: 1
Suggesters: 4
Security: 0
Stars: 18
Watchers: 2
Forks: 0
Open Issues: 2
Type:kirby-plugin
Requires
- php: >=7.3.0
- getkirby/composer-installer: ^1.1
Requires (Dev)
- getkirby/cms: ^3.5
- php-coveralls/php-coveralls: ^2.4
- phpunit/phpunit: ^9.5
Suggests
- bnomei/kirby3-feeds: Adds a xml sitemap which will be automatically be included in the robots.txt
README
Manage the robots.txt from the Kirby config file.
Similar Plugin
Commercial Usage
Support open source!
This plugin is free but if you use it in a commercial project please consider to sponsor me or make a donation.
If my work helped you to make some cash it seems fair to me that I might get a little reward as well, right?
Be kind. Share a little. Thanks.
‐ Bruno
M | O | N | E | Y |
---|---|---|---|---|
Github sponsor | Patreon | Buy Me a Coffee | Paypal dontation | Hire me |
Installation
- unzip master.zip as folder
site/plugins/kirby3-robots-txt
or git submodule add https://github.com/bnomei/kirby3-robots-txt.git site/plugins/kirby3-robots-txt
orcomposer require bnomei/kirby3-robots-txt
Setup
The plugin generates automatic defaults for the starterkit. You do not have to enter them in the config file. But if you would it would look like this.
TIP: If you are using the kirby3-feeds Plugin or kirby3-xmlsitemap Plugin your sitemap will be automatically added to the
robots.txt
file. You can skip setting thebnomei.robots-txt.sitemap
config value tositemap.xml
.
defaults for starterkit
<?php return [ 'bnomei.robots-txt.content' => null, // string or callback 'bnomei.robots-txt.sitemap' => null, // string or callback 'bnomei.robots-txt.groups' => [ // array or callback '*' => [ // user-agent 'disallow' => [ '/kirby/', '/site/', ], 'allow' => [ '/media/', ] ] ] ];
using a plain string
<?php return [ 'bnomei.robots-txt.content' => 'user-agent: * disallow: /kirby/ disallow: /site/ allow: /media/', ];
using a callback
<?php return [ 'bnomei.robots-txt.content' => function() { return site()->myRobotsTxtContentField()->value(); }, ];
sitemap and multiple user-agents
<?php return [ 'bnomei.robots-txt.sitemap' => 'sitemap.xml', 'bnomei.robots-txt.groups' => [ '*' => [ 'disallow' => [ '/', ], ], 'googlebot-images' => [ 'allow' => [ '/media/', ] ] ] ];
Staging Server? Debug Mode = Disallow all
Since v1.3.0 when you set the global Kirby debug
config to true
the plugin will disallow all indexing for all user-agents. This is especially usefull on a staging server but you could consider xml-sitemap and rss-feed among other things as well.
Disclaimer
This plugin is provided "as is" with no guarantee. Use it at your own risk and always test it yourself before using it in a production environment. If you find any issues, please create a new issue.
License
It is discouraged to use this plugin in any project that promotes racism, sexism, homophobia, animal abuse, violence or any other form of hate speech.