I'm trying to do an out-of-tree build for a bunch of materials related to a course I'm teaching. For other tools (e.g., the C++ compiler), any output paths are interpreted relative to the current (out-of-tree) working directory. For instance:
[~/course/build]$ c++ -c ../src/foo.cpp -o obj/foo.o
will result in a foo.o being created in the ~/course/build/obj directory. With Hugo, however:
[~/course/build]$ hugo --source=../website --destination=website
I end up with generated files in the ~/course/website/website directory.
It looks like various things in commands/hugo.go use helpers.AbsPathify(viper.GetString("PublishDir")), which constructs an absolute path by joining the _source_ directory and a relative path. If there were another helper that did the same from the _current_ directory, Hugo would behave more like other tools do, making out-of-tree builds (potentially with read-only sources) easier to do.
So this isn't so much of a bug as it's a feature. The way it's designed to work (and does work) is that all relative paths are based off of the source directory (a relative path given there is based off the CWD).
Any absolute paths provided will be treated as absolute.
There are a few reasons for this: