Automatically removing robots.txt provided by Drupal core

Created on 2 December 2016, over 8 years ago
Updated 17 April 2025, 12 days ago

Following up this closed issue https://www.drupal.org/node/1260912

I have a solution for D8.

We can use composer scripts to remove the file.

📌 Task
Status

Fixed

Version

1.0

Component

Documentation

Created by

🇬🇧United Kingdom marcelovani London

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇳🇬Nigeria chike Nigeria

    As per #9

    This didn't work for me.

                "file-mapping": {
                    "public_html/robots.txt": {
                        "mode": "skip"
                    }
                }

    The file still got scaffolded.

    This worked.
    ,

        "scripts": {
          "post-install-cmd": [
            "rm public_html/robots.txt"
          ],
          "post-update-cmd": [
            "rm public_html/robots.txt"
          ]
        }

    The file got removed.

  • 🇳🇬Nigeria chike Nigeria

    Well. Not until I moved to the live server. On the live server, the script equally didn't work for me.

Production build 0.71.5 2024