diff --git a/caddyhugo.go b/caddyhugo.go index 2f9926c..fc27f19 100644 --- a/caddyhugo.go +++ b/caddyhugo.go @@ -467,6 +467,9 @@ func (ch CaddyHugo) NewContent(w http.ResponseWriter, r *http.Request) (int, err } filename := path.Join(ctype, name) + if ctype == "default" { + filename = name + } cmd := exec.Command("hugo", "new", filename) cmd.Dir = ch.Site.Root diff --git a/templates.go b/templates.go index b5443fb..2ba9595 100644 --- a/templates.go +++ b/templates.go @@ -107,6 +107,9 @@ func baseNoExt(name string) string { func (t tmplData) IframeSource() string { name := baseNoExt(t.docref.name) ctype := baseNoExt(path.Dir(t.docref.name)) + if ctype == "content" { + return fmt.Sprintf("/hugo/draft/%s/%s/", base64.RawURLEncoding.EncodeToString([]byte(t.docref.name)), strings.Replace(name, " ", "-", -1)) + } return fmt.Sprintf("/hugo/draft/%s/%s/%s/", base64.RawURLEncoding.EncodeToString([]byte(t.docref.name)), ctype, strings.Replace(name, " ", "-", -1)) }