diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2021-11-15 10:25:30 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2021-11-15 11:21:39 +0100 |
commit | b8155452ac699473b6b2a34f53988dee01b4da34 (patch) | |
tree | 07f88f6bdac3f09d009dc818ab9a2b95facb03aa /create/content.go | |
parent | 08552a7a4cd1fe64efdd2f1b95142fa4295cb298 (diff) |
Improve error when we cannot determine content directory in "hugo new"
See #9166
Diffstat (limited to 'create/content.go')
-rw-r--r-- | create/content.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/create/content.go b/create/content.go index 524803d36..ce5934e4a 100644 --- a/create/content.go +++ b/create/content.go @@ -60,7 +60,11 @@ func NewContent(h *hugolib.HugoSites, kind, targetPath string) error { cf := hugolib.NewContentFactory(h) if kind == "" { - kind = cf.SectionFromFilename(targetPath) + var err error + kind, err = cf.SectionFromFilename(targetPath) + if err != nil { + return err + } } b := &contentBuilder{ |