Hello.
I am developing a multilanguage site with Hugo.
In my config.toml
I have set defaultContentLanguageInSubdir = true
that, as the documentation indicates, render the default content language in a subdir, e.g. content/en/
and the site root /
will then redirect to /en/
.
This redirection is created by Hugo by adding the following index.html
file in the root of the site:
<!DOCTYPE html><html><head><title>http://localhost:1313/en</title><link rel="canonical" href="http://localhost:1313/en"/><meta name="robots" content="noindex"><meta charset="ut f-8" /><meta http-equiv="refresh" content="0; url=http://localhost:1313/en" /></head></h tml>
This behavior is correct. But I believed that I could create my custom index.html
that I would save in the /static/
or /themes/mytheme/static/
directories and this does not work.
If I create a custom file /static/index.html
or /themes/mytheme/static/index.html
with, for example, a map that allows visitors to choose their preferred language other than the default one, it will work only temporarily while ‘hugo server’ is running, if I restart the server or build the site, hugo will replace my custom index.html
with the redirection to the default language.
Isn’t it possible to prevent hugo from creating its own /index.html
if it find a /static/index.html
or /themes/mytheme/static/index.html
?