Skip to content

Commit 98db275

Browse files
committed
update readme
1 parent 8072561 commit 98db275

File tree

1 file changed

+37
-18
lines changed

1 file changed

+37
-18
lines changed

readme.md

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SilverStripe Robots.txt
1+
# Silverstripe Robots.txt
22

33
[![Version](http://img.shields.io/packagist/v/innoweb/silverstripe-robots.svg?style=flat-square)](https://packagist.org/packages/innoweb/silverstripe-robots)
44
[![License](http://img.shields.io/packagist/l/innoweb/silverstripe-robots.svg?style=flat-square)](license.md)
@@ -7,11 +7,11 @@
77

88
Adds a Robots.txt file that is configurable from /admin/settings/.
99

10-
This module has been inspired by MichaelJJames' [silverstripe-robots](https://github.com/MichaelJJames/silverstripe-robots) and Symbiote's [Multisites](https://github.com/symbiote/silverstripe-multisites).
10+
This module supports single site as well as [multisites](https://github.com/symbiote/silverstripe-multisites) setups.
1111

1212
## Requirements
1313

14-
* SilverStripe CMS 4.x
14+
* Silverstripe CMS 4.x
1515

1616
## Installation
1717

@@ -23,30 +23,51 @@ Then run dev/build.
2323

2424
## Configuration
2525

26-
You can disallow robots from accessing your site using the config.
26+
On the SiteConfig (or Site is Multisites is installed) there is a setting in the CMS that lets you set the robots mode. The three options are:
27+
* Allow all
28+
* Disallow all
29+
* Custom content
2730

28-
You can add the following code to your .env file to disallow robots for an environment.
31+
The output of all three states is managed through templates and can be overwritten for an app or theme.
32+
33+
### Allow all
34+
35+
When switched to 'allow all' the module uses the template `Innoweb/Robots/RobotsController_allow.ss` with the following default content:
36+
37+
```
38+
<% if $GoogleSitemapURL %>Sitemap: {$GoogleSitemapURL}<% end_if %>
39+
User-agent: *
40+
Disallow: /dev/
41+
Disallow: /admin/
42+
Disallow: /Security/
2943
```
30-
ROBOTS_DISALLOW="true"
31-
```
3244

33-
You can also disallow access by using the yml config:
45+
The module checks whether the [Google Sitemaps module](https://github.com/wilr/silverstripe-googlesitemaps) is installed and injects the sitemap URL automatically.
46+
47+
It allows access to all pages and disallows access to development and security URLs by default.
48+
49+
### Disallow all
50+
51+
When switched to 'disallow all' the module uses the template `Innoweb/Robots/RobotsController_disallow.ss` with the following default content:
52+
3453
```
35-
RobotsController:
36-
disallow_robots: true
54+
UserAgent: *
55+
Disallow: /
3756
```
3857

39-
The default value for this configuration is `false`, allowing access to the site (except if the romots.txt field content is empty, see below).
58+
This disallows all robots from accessing any page on the site.
4059

41-
Both these methods will add a default robots.txt content in place, that will disallow robots from accessing your site.
60+
### Custom content
4261

43-
## robots.txt content
62+
This setting reveals a text field in the CMS where custom code can be entered.
4463

45-
To add a romots.txt to you site, paste in your robots.txt configuration into the textarea inside the robots tab in admin/settings/.
64+
The template contains the following code and doesn't add anything to the custom code entered:
4665

47-
### Example content
66+
```
67+
$RobotsContent.RAW
68+
```
4869

49-
Here a good standard robots.txt configuration:
70+
A good standard robots.txt configuration for Silverstripe looks as follows. This is used as default when the module is switched to 'allow all':
5071

5172
```
5273
Sitemap: https://www.example.com/sitemap.xml
@@ -56,8 +77,6 @@ Disallow: /admin/
5677
Disallow: /Security/
5778
```
5879

59-
If you leave the field empty, a default content will be used that blocks robots from accessing the site.
60-
6180
## License
6281

6382
BSD 3-Clause License, see [License](license.md)

0 commit comments

Comments
 (0)