How to have root static folder with multilingual setup?


#1

I’m working on my first multi-lingual website with Hugo. These are my language settings:

defaultContentLanguage = "nl"
defaultContentLanguageInSubDir = true

[languages]
    [languages.nl]
        languageName = "Nederlands"
        contentDir = "content/nl"
            
    [languages.en]
        languageName = "English"
        contentDir = "content/en"

Here’s the problem: I have no root static directory. That means files I put into

/static/robots.txt

end up in

/nl/robots.txt
/en/robots.txt

Is there a way to still use a multi-lingual setup with Hugo where each language has its own subfolder, but still be able to place files at the website root folder?

Because currently I cannot upload the proper robots.txt file since it gets the wrong location.

(Plus it feels unnecessary to have duplicates of CSS, JavaScript, and all images.)


hugo env
Hugo Static Site Generator v0.51/extended windows/amd64 BuildDate: unknown
GOOS="windows"
GOARCH="amd64"
GOVERSION="go1.11"

#2

I think you experience this issue:


and maybe this one too:


#3

That’s indeed the issue that I have. Thanks for the quick reply & have a nice weekend. :slight_smile: