The problem arise as soon as replace the $path variable with $test (containing a dynamic path). At that point, even on the English version, Hugo throws an exception that could not locate the /data/it/home folder and I don’t explain where /it/ is read considering that {{ .Lang }} is not an array.
Are you 100% sure those directories exist for every languages set in your project?
You are using a different domain for each language right? (it does not appear so in your languages config but your are mentioning two URLs for each language.
Hello @regis I have stripped the baseURL from the config above proposed, which is the one responsible for setting up the two different localhost in this case (as far as I can understand from the documentation).
This is goes in line with what I want since files in the public dir are written respectively in the /en and /it folders.
To your question, though, the path is a relative one formed on the spot, but in any case is not included in the contentDir rather in the data folder. I don’t want those .html files being published on their own, and that’s why I’m adding them there.
So my folder structure looks like
|_ content
| |__ Empty so far
|_ data
|_en
| |_home
|_it
|_home
As I am trying to load from data/it/home or data/en/home from the respective hostname, I though this could work. And in fact, if I do use and hardcoded path, this work. It’s just when I’m trying to use the dynamically formed path that I have troubles.
Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.
If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.