fixing /default/ in the path for default post types
This commit is contained in:
@@ -467,6 +467,9 @@ func (ch CaddyHugo) NewContent(w http.ResponseWriter, r *http.Request) (int, err
|
|||||||
}
|
}
|
||||||
|
|
||||||
filename := path.Join(ctype, name)
|
filename := path.Join(ctype, name)
|
||||||
|
if ctype == "default" {
|
||||||
|
filename = name
|
||||||
|
}
|
||||||
|
|
||||||
cmd := exec.Command("hugo", "new", filename)
|
cmd := exec.Command("hugo", "new", filename)
|
||||||
cmd.Dir = ch.Site.Root
|
cmd.Dir = ch.Site.Root
|
||||||
|
|||||||
@@ -107,6 +107,9 @@ func baseNoExt(name string) string {
|
|||||||
func (t tmplData) IframeSource() string {
|
func (t tmplData) IframeSource() string {
|
||||||
name := baseNoExt(t.docref.name)
|
name := baseNoExt(t.docref.name)
|
||||||
ctype := baseNoExt(path.Dir(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))
|
return fmt.Sprintf("/hugo/draft/%s/%s/%s/", base64.RawURLEncoding.EncodeToString([]byte(t.docref.name)), ctype, strings.Replace(name, " ", "-", -1))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user