"source" config variable seems to be ignored by `hugo new`

A “source” variable set in config.toml seems to be ignored when running hugo new, and new files are always created relative to the current working directory instead.

It seems like an issue… is it?

Script to reproduce:

# Make the new site:
cd Desktop
mkdir hugotest
cd hugotest
hugo new site issue-demo

# Move the config.toml file into the current working directory
mv issue-demo/config.toml ./

# Change the source in the config
echo 'source = "issue-demo"' >> config.toml 

# Try to create a new article:
hugo new section/article.html

Expected result:

/Users/john/Desktop/hugotest/issue-demo/content/section/article.html created

Actual result:

/Users/john/Desktop/hugotest/content/section/article.html created


Use hugo --source <path> new <section/file> — this seems to be respected correctly.


Hugo Static Site Generator v0.30.2 darwin/amd64 BuildDate: 2017-11-08T11:28:06-06:100:


I’m running into this on a project where hugo is only one component, and we’re trying to keep the project root directory lean with just config files for build tools (hugo, gulp, npm, etc) and everything for each component in a subdirectory (src/hugo, src/scss, etc.) It all works well, except that we have to cd src/hugo && hugo new --config ../../config.toml section/article.html all the time, and it would be nice if the source variable in config.toml would tell hugo to make new files where they belong when it is invoked from the project root.