Create robots.txt in the domain root directory
authorNico <nico.duesing@secure.mailbox.org>
Sat, 20 Jun 2020 13:00:25 +0000 (15:00 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sat, 20 Jun 2020 15:13:26 +0000 (17:13 +0200)
commit3466884e364d0df39394742697d6fa0b37d49e64
treefa76e1990886d69353e0ce4176fc2ebef0dec638
parent6ff435aa3f19a628f26d5ce755238e359eb77df6
Create robots.txt in the domain root directory

Before a robots.txt is created in every Site. So in public/robots.txt if there are no languages (was correct). But if there are multiple languages in every language directory, too (was wrong). If defaultContentLanguageInSubdir is true, no language is created into the root directory, so no robots.txt is in the root directory (was wrong). If multihosts are configured for each language, that is the only case where one robots.txt must be created in each language directory (was correct).

I've changed the behaviour, that only in the multihost case the robots.txt is created in the language directories. In any other case it is created in public/robots.txt. I've also added tests that files are not created in the wrong directories.

Fixes #5160
See also #4193
hugolib/hugo_sites.go
hugolib/hugo_sites_build.go
hugolib/hugo_sites_build_test.go
hugolib/hugo_sites_multihost_test.go
hugolib/site.go
hugolib/testhelpers_test.go