Skip to content

Commit

Permalink
VOTE-972: Add robotstxt module. set robots.txt file per env (#758)
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-crowder authored Jul 27, 2024
1 parent be18638 commit 709759e
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
/drush/Commands/contrib/
/web/profiles/contrib/
/web/libraries/
/web/robots.txt

# Ignore configuration files that may contain sensitive information.
/web/sites/*/settings*.php
Expand Down
9 changes: 9 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"drupal/redirect": "^1.8",
"drupal/remove_http_headers": "^2.0",
"drupal/rest_views": "^3.0",
"drupal/robotstxt": "^1.5",
"drupal/s3fs": "^3.1",
"drupal/samlauth": "^3.8",
"drupal/simple_sitemap": "^4.1",
Expand Down Expand Up @@ -143,5 +144,13 @@
" composer remove drupal/core-project-message"
]
}
},
"scripts": {
"post-install-cmd": [
"test -e web/robots.txt && rm web/robots.txt || echo The default robots.txt file has been deleted."
],
"post-update-cmd": [
"test -e web/robots.txt && rm web/robots.txt || echo The default robots.txt file has been deleted."
]
}
}
57 changes: 57 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions config/production/robotstxt.settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
_core:
default_config_hash: ceCx5XZ_ay1Mxcv-sB95U_fBKoVkpvo8RaQiwutSZLI
content: "#\r\n# robots.txt\r\n#\r\n# This file is to prevent the crawling and indexing of certain parts\r\n# of your site by web crawlers and spiders run by sites like Yahoo!\r\n# and Google. By telling these \"robots\" where not to go on your site,\r\n# you save bandwidth and server resources.\r\n#\r\n# This file will be ignored unless it is at the root of your host:\r\n# Used: http://example.com/robots.txt\r\n# Ignored: http://example.com/site/robots.txt\r\n#\r\n# For more information about the robots.txt standard, see:\r\n# http://www.robotstxt.org/robotstxt.html\r\n\r\nUser-agent: *\r\nCrawl-delay: 10\r\n\r\n# Sitemaps\r\nSitemap: https://vote.gov/sitemap.xml\r\n\r\n# CSS, JS, Images\r\nAllow: /*.css$\r\nAllow: /*.js$\r\nAllow: /core/*.css$\r\nAllow: /core/*.css?\r\nAllow: /core/*.js$\r\nAllow: /modules/*.css$\r\nAllow: /modules/*.css?\r\nAllow: /modules/*.js$\r\nAllow: /modules/*.js?\r\nAllow: /modules/*.gif\r\nAllow: /modules/*.jpg\r\nAllow: /modules/*.jpeg\r\nAllow: /modules/*.png\r\nAllow: /themes/*.css$\r\nAllow: /themes/*.css?\r\nAllow: /themes/*.js$\r\nAllow: /themes/*.js?\r\nAllow: /themes/*.gif\r\nAllow: /themes/*.jpg\r\nAllow: /themes/*.jpeg\r\nAllow: /themes/*.png\r\n# Directories\r\nDisallow: /core/\r\nDisallow: /modules/\r\nDisallow: /themes/\r\n"
1 change: 1 addition & 0 deletions config/sync/config_split.config_split.production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ theme: { }
complete_list:
- log_stdout.settings
- new_relic_rpm.settings
- robotstxt.settings
- s3fs.settings
- samlauth.authentication
- usagov_login.settings
Expand Down
1 change: 1 addition & 0 deletions config/sync/core.extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ module:
remove_http_headers: 0
rest: 0
rest_views: 0
robotstxt: 0
serialization: 0
simple_sitemap: 0
system: 0
Expand Down
1 change: 1 addition & 0 deletions config/sync/robotstxt.settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
content: "#\r\n# robots.txt\r\n#\r\n# This file is to prevent the crawling and indexing of certain parts\r\n# of your site by web crawlers and spiders run by sites like Yahoo!\r\n# and Google. By telling these \"robots\" where not to go on your site,\r\n# you save bandwidth and server resources.\r\n#\r\n# This file will be ignored unless it is at the root of your host:\r\n# Used: http://example.com/robots.txt\r\n# Ignored: http://example.com/site/robots.txt\r\n#\r\n# For more information about the robots.txt standard, see:\r\n# http://www.robotstxt.org/robotstxt.html\r\n\r\nUser-agent: *\r\nDisallow: /\r\n"
2 changes: 2 additions & 0 deletions config/sync/user.role.site_builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ dependencies:
- redirect
- remove_http_headers
- rest
- robotstxt
- simple_sitemap
- system
- taxonomy
Expand Down Expand Up @@ -110,6 +111,7 @@ permissions:
- 'administer redirect settings'
- 'administer redirects'
- 'administer rest resources'
- 'administer robots.txt'
- 'administer site configuration'
- 'administer sitemap settings'
- 'administer software updates'
Expand Down
20 changes: 0 additions & 20 deletions web/robots.txt

This file was deleted.

0 comments on commit 709759e

Please sign in to comment.