I work on a bilingual website built with Hugo, and to build it i run the
hugo command twice, each time with a different
config file. The problem is that i have two directories under public that have the same static files (each has its own copy). This is unnecessary and redundant. I wonder if there is a way to let theme share the same static files (css, js, images).
Sure. Just use the default static dir setting, or the same for both. The static files will be copied twice, but as they are the same … only one of each end up in public.
thanks @bep! sorry for being so noob, but where is it documented?
Thanks. If i understand from the documentation - that will set the static files source dir, not the target. It seems not to work.
I added the following line to my config:
staticdis = "public/static"
And when running Hugo i get the following:
ERROR: 2015/10/24 Unable to find Static Directory: /home/me/Hugo/public/static/
That is correct and not what you are doing.
I’m sorry but i do not understand your reply.
There is no target static dir setting, only source. Target will be relative to the source.
Ah. So does that mean that one can’t have only one copy of static files for a multilingual site?
No. You can have multiple version by
staticdir to different values and putting the static files in those directories.
I guess it is also possible to have two totally separate Hugo sites, or build to multiple output folders (public1, public2), but I suggest you read the core part of the documentation, try to understand it.