mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-22 21:42:50 +02:00
Fix path resolution in hugo new
With theme and project with content directories and command on the form `hugo new posts/test.md`. Fixes #9129
This commit is contained in:
@@ -57,4 +57,22 @@ Hello World.
|
||||
b.Assert(buf.String(), qt.Contains, `title: "Mypage"`)
|
||||
})
|
||||
|
||||
// Issue #9129
|
||||
c.Run("Content in both project and theme", func(c *qt.C) {
|
||||
b := newTestSitesBuilder(c)
|
||||
b.WithConfigFile("toml", `
|
||||
theme = 'ipsum'
|
||||
`)
|
||||
|
||||
themeDir := filepath.Join("themes", "ipsum")
|
||||
b.WithSourceFile("content/posts/foo.txt", `Hello.`)
|
||||
b.WithSourceFile(filepath.Join(themeDir, "content/posts/foo.txt"), `Hello.`)
|
||||
b.CreateSites()
|
||||
cf := NewContentFactory(b.H)
|
||||
abs, err := cf.CreateContentPlaceHolder(filepath.FromSlash("posts/test.md"))
|
||||
b.Assert(err, qt.IsNil)
|
||||
b.Assert(abs, qt.Equals, filepath.FromSlash("content/posts/test.md"))
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user