From b8155452ac699473b6b2a34f53988dee01b4da34 Mon Sep 17 00:00:00 2001 From: Bjørn Erik Pedersen Date: Mon, 15 Nov 2021 10:25:30 +0100 Subject: Improve error when we cannot determine content directory in "hugo new" See #9166 --- create/content.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'create') 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{ -- cgit v1.2.3